00:33:56 | NimEventer | New thread by Icedquinn: Math library for renderers and GUIs, see https://forum.nim-lang.org/t/9353 |
00:37:08 | FromDiscord | <Nerve> sent a long message, see http://ix.io/46RA |
00:37:17 | FromDiscord | <Nerve> (edit) "long message," => "code paste," | "http://ix.io/46RA" => "https://play.nim-lang.org/#ix=46RB" |
00:37:26 | FromDiscord | <Elegantbeef> They're iterators |
00:37:30 | FromDiscord | <Nerve> (edit) "https://play.nim-lang.org/#ix=46RB" => "https://play.nim-lang.org/#ix=46RC" |
00:38:02 | FromDiscord | <Nerve> Okay, I guess I'd have to resolve them into sequences, but why am I getting undeclared field? |
00:38:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RD |
00:38:24 | FromDiscord | <Elegantbeef> Cause iterators are only considered in a few cases |
00:38:51 | FromDiscord | <Elegantbeef> iterators are considered inside `typeof`, when the argument is `iterable` and inside for loops |
00:39:05 | FromDiscord | <Nerve> So the iterator effectively doesn't exist unless you use it in a special form that handles the iterator? |
00:39:23 | FromDiscord | <Elegantbeef> Inlined iterators are templates basically so correct |
00:39:42 | FromDiscord | <Nerve> Is there a quick way to resolve an iterator into a list or sequence? |
00:39:52 | FromDiscord | <Elegantbeef> `setutils.toSeq` |
00:39:58 | FromDiscord | <Elegantbeef> `sequtils`\ |
00:40:01 | FromDiscord | <Nerve> Thanks, let me try it |
00:40:12 | FromDiscord | <Elegantbeef> Generally though it's best to avoid that though |
00:40:32 | FromDiscord | <Elegantbeef> Unless you want a collection of your values it's not great for performance(if you care) |
00:40:58 | FromDiscord | <Nerve> I'm learning and converting right now, I'll get to idiomatic golfing later |
00:41:01 | FromDiscord | <Elegantbeef> Also counttable has `largest` and `smallest` |
00:41:09 | FromDiscord | <Nerve> oh, really? |
00:41:11 | FromDiscord | <Nerve> that's useful |
00:41:15 | FromDiscord | <Elegantbeef> Yep |
00:48:34 | FromDiscord | <Elegantbeef> I suppose i should not if an iterator is declared with `{.closure.}` it's a first class iterator and does indeed exist at runtime |
00:48:56 | FromDiscord | <Elegantbeef> Which means you can hold onto it in variables or pass it into procedures |
00:57:32 | FromDiscord | <Nerve> Is there any way to sort a CountTable by keys instead of values? Or would I need to resolve the keys into a seq and sort that for iteration? |
00:59:33 | FromDiscord | <Elegantbeef> The sequence is probably the way to do it |
00:59:42 | FromDiscord | <Elegantbeef> Or store the keys sorted in another collection |
01:12:43 | FromDiscord | <Nerve> All worked, thanks. Got similar performance to what I was able to get out of D. |
01:12:57 | FromDiscord | <Nerve> In less code of course |
01:13:02 | FromDiscord | <Elegantbeef> what are you compile flags? |
01:13:23 | FromDiscord | <Nerve> just -d:release |
01:14:25 | FromDiscord | <Elegantbeef> Always fun to try `--mm:orc` or `--mm:arc` |
01:14:41 | FromDiscord | <Elegantbeef> Can even throw in a `-d:lto` if you want to enable link time optimisations |
01:21:31 | FromDiscord | <Bubblie> can you do newSeq[cuint] because for some reason that isn't working |
01:21:48 | FromDiscord | <Elegantbeef> `newSeq[cuint](10)` should work |
01:21:56 | FromDiscord | <Bubblie> the paranthesis is length right? |
01:22:03 | FromDiscord | <Elegantbeef> yes |
01:22:13 | FromDiscord | <Bubblie> can you make a newSeq without length? |
01:22:19 | FromDiscord | <Bubblie> kinda like ArrayLists in java |
01:22:28 | FromDiscord | <Elegantbeef> `newSeqWithCap[cuint](capacityHere)` |
01:22:36 | FromDiscord | <Elegantbeef> or just do `var mySeq: seq[cuint]` |
01:22:42 | FromDiscord | <Bubblie> ah okay :) thank you! |
01:24:55 | FromDiscord | <voidwalker> How can I conditionally add something to a string, in a single let x = expression ? |
01:25:20 | FromDiscord | <voidwalker> I think I saw something like that, sort of like python |
01:25:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RI |
01:25:37 | FromDiscord | <voidwalker> oh, I thought it was possible to do oneliner : ) |
01:25:47 | FromDiscord | <voidwalker> I guess I can oneline that |
01:25:50 | FromDiscord | <Elegantbeef> You can i just despise it |
01:26:10 | FromDiscord | <voidwalker> despise ? |
01:26:20 | FromDiscord | <Elegantbeef> Yes i dislike 1 line if expressions |
01:26:34 | FromDiscord | <voidwalker> i like low linecount |
01:26:52 | FromDiscord | <voidwalker> 80 char lines + 100 char comments : D |
01:26:58 | FromDiscord | <Elegantbeef> So write all your code in `()` and have very few lines |
01:27:17 | FromDiscord | <reversem3> nim c -d\:release --passL\:" pkg-config --cflags --lib elementary" enim.nim so --cflags doesn't work |
01:27:58 | FromDiscord | <reversem3> does pkg-config have to be in quotes ? |
01:28:56 | FromDiscord | <voidwalker> ``nim |
01:30:58 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RJ |
01:31:04 | FromDiscord | <domosokrat> reversem3\: it has to be --passL\:"$(pkg-config …)" |
01:31:24 | FromDiscord | <voidwalker> This is what I meant Beef, it works. Nice. But I can't get rid of the else: |
01:31:28 | FromDiscord | <Elegantbeef> That's what i consider unreadable code |
01:31:44 | FromDiscord | <voidwalker> If I remove the else: it tells me i need to use or discard the if string |
01:31:55 | FromDiscord | <Elegantbeef> Of course |
01:32:01 | FromDiscord | <Elegantbeef> `else: ""` |
01:32:14 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=46RK |
01:32:21 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=46RK" => "https://play.nim-lang.org/#ix=46RL" |
01:32:42 | * | derpydoo quit (Ping timeout: 268 seconds) |
01:33:28 | FromDiscord | <voidwalker> hm maybe some other time, doesn't seem fitting atm : ) |
01:34:29 | FromDiscord | <Tuatarian> is there any reason why it would be a bad idea to use arc and manually free cylic datastructures? |
01:35:33 | FromDiscord | <Elegantbeef> You arent guaranteed they're freed |
01:37:53 | * | neceve joined #nim |
01:38:53 | FromDiscord | <Elegantbeef> You also basically will just make a cycle collector in the end |
01:39:03 | FromDiscord | <reversem3> '/home/nixfreak/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]↵command line(1, 2) Error\: fatal error\: command expects a filename |
01:39:05 | FromDiscord | <Elegantbeef> You do realize orc is only ran on types that are possible to be cyclical right? |
01:42:42 | FromDiscord | <reversem3> yeah tried that , nim c -d\:release --passL\: $(pkg-config --cflags --libs elementary) enim.nim↵command line(1, 2) Error\: invalid command line option\: '-I' |
01:43:20 | FromDiscord | <Elegantbeef> Voidwalker you didnt just make me write a silly fizzbuzz in a single line |
01:43:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RO |
01:47:01 | FromDiscord | <voidwalker> very elegant : ) |
01:47:08 | FromDiscord | <Elegantbeef> I hate you |
01:47:09 | FromDiscord | <Bubblie> so in java ArrayLists have the ability to get something in it based on sequence |
01:47:14 | FromDiscord | <Bubblie> (edit) "sequence" => "index" |
01:47:17 | FromDiscord | <Bubblie> is there something like that |
01:47:19 | * | neceve quit (Ping timeout: 252 seconds) |
01:47:19 | FromDiscord | <Bubblie> in nim seq? |
01:47:22 | FromDiscord | <Elegantbeef> Yes |
01:47:28 | FromDiscord | <Elegantbeef> `mySeq[i]` |
01:47:38 | FromDiscord | <Bubblie> oh 😭 |
01:47:42 | FromDiscord | <Elegantbeef> Nim isnt a foreign entity try what you're used to 😄 |
01:47:44 | FromDiscord | <Bubblie> im so use to doing a method like .get |
01:47:51 | FromDiscord | <domosokrat> reversem3\: where are the quotes in your call? |
01:48:01 | FromDiscord | <voidwalker> I agree with you on readability, but if it's stupid code of little value, i say compress it. The overall module readability wins |
01:48:08 | FromDiscord | <Elegantbeef> This is your mind on operator overloading!↵(@Bubblie) |
01:48:13 | FromDiscord | <Bubblie> true |
01:48:47 | FromDiscord | <Elegantbeef> Vertical \@voidwalker) |
01:50:19 | FromDiscord | <domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=46RP |
01:50:32 | FromDiscord | <Elegantbeef> That doesnt compile |
01:50:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RQ |
01:51:54 | FromDiscord | <domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=46RR |
01:52:00 | FromDiscord | <Elegantbeef> Yep |
01:53:09 | FromDiscord | <domosokrat> But I claim that `let a = b + c` is more readable \:-) |
01:54:50 | FromDiscord | <domosokrat> argh, why is it already that late 😴 |
01:56:28 | FromDiscord | <reversem3> Yep you're right I forgot them ,thanks |
01:56:50 | * | arkurious quit (Quit: Leaving) |
01:58:43 | FromDiscord | <Bubblie> do you any of you know how to cast a cstring to a normal nim string? |
01:58:59 | FromDiscord | <Elegantbeef> You dont cast it you do `$myCstr` |
01:59:07 | FromDiscord | <Bubblie> Oh? |
01:59:41 | FromDiscord | <Elegantbeef> Nim strings are pascal strings, cstrings are null terminated strings |
02:00:12 | FromDiscord | <Bubblie> wait so you put a dollar sign in front of the nim string and it is now a cstring? |
02:00:28 | FromDiscord | <Bubblie> sorry im a bit confused 😅 |
02:00:50 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Nim strings are pascal": ah okay |
02:00:53 | FromDiscord | <Elegantbeef> `$` is nim's stringification operator |
02:01:10 | FromDiscord | <Elegantbeef> `$myCstring` will convert a null terminated string into a Nim string |
02:01:18 | FromDiscord | <Bubblie> oh I need the opposite of that |
02:01:29 | FromDiscord | <Bubblie> pascal string to null terminated |
02:01:31 | FromDiscord | <Elegantbeef> > cast a cstring to a normal nim string |
02:01:44 | FromDiscord | <Elegantbeef> `.cstring` will give you an unsafe cstring |
02:02:13 | FromDiscord | <Bubblie> hmm should I try to make this stuff more safe then? |
02:02:24 | FromDiscord | <Elegantbeef> No clue what you're doing |
02:02:31 | FromDiscord | <Bubblie> vulkan graphics api |
02:02:40 | FromDiscord | <Bubblie> handling glfw extensions |
02:02:42 | FromDiscord | <Elegantbeef> You're probably fine to use that cstring |
02:02:51 | FromDiscord | <Bubblie> okay thank you :) |
02:34:55 | FromDiscord | <voidwalker> does this make sense? |
02:34:55 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RU |
02:35:23 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/xvV |
02:35:43 | FromDiscord | <voidwalker> (edit) "https://paste.rs/wxx" => "https://play.nim-lang.org/#ix=46RW" |
02:35:45 | FromDiscord | <voidwalker> how do I do the "&" ? |
02:36:33 | FromDiscord | <Elegantbeef> `{"bar": "qux", "foo": "baz"}`? |
02:37:19 | FromDiscord | <voidwalker> If so, then the examples from the docs suck |
02:37:52 | FromDiscord | <Elegantbeef> Why the proc takes a `openArray[(string, string)]` |
02:42:32 | FromDiscord | <voidwalker> ok that syntax works |
02:42:48 | FromDiscord | <voidwalker> now how do I append my oneliner if true: "=true" else: ? |
02:43:06 | FromDiscord | <voidwalker> I now got an URI, not a string, hmm |
02:43:09 | FromDiscord | <Elegantbeef> you dont do it in a one liiner |
02:43:52 | FromDiscord | <voidwalker> sigh, should've kept it a string 😦 |
02:44:05 | FromDiscord | <Elegantbeef> no comment |
02:44:14 | FromDiscord | <voidwalker> no point in all that fancy schmancy deconstruct/reconstruct |
02:44:21 | FromDiscord | <voidwalker> just .replace(" ", "%20") |
02:45:09 | FromDiscord | <Elegantbeef> That fails for a ton of characters |
02:45:41 | FromDiscord | <voidwalker> maybe you are right... |
02:45:58 | FromDiscord | <Elegantbeef> The "proper" way is to use uri cause you arent dealing with a string |
02:46:12 | FromDiscord | <Elegantbeef> It might look like a string and quack like a string but it's not a string |
02:46:32 | FromDiscord | <voidwalker> all URIs are strings. not all strings are URIs |
02:46:53 | FromDiscord | <Elegantbeef> strings are untyped binary blobs, so yes |
02:47:23 | FromDiscord | <voidwalker> so are you sure there is no way to put that conditional & at the end, using whatever macro syntactic sugar I use with the / ? |
02:47:41 | FromDiscord | <Elegantbeef> That's just a procedure |
02:48:01 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RZ |
02:48:12 | FromDiscord | <Elegantbeef> You need to add an element conditionally to an array that's not possible |
02:48:13 | FromDiscord | <voidwalker> that breaks something in the parsing |
02:50:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46S0 |
02:50:14 | FromDiscord | <Elegantbeef> Dont you dare say "but my one liner" |
02:50:35 | FromDiscord | <Elegantbeef> If you want it done in one line make a procedure that handles it |
02:50:55 | FromDiscord | <Elegantbeef> Then you can do `let myUri = imdbUri(query, ref_, exact)` |
02:51:34 | FromDiscord | <voidwalker> A procedure should not exist for the sole purpose of having a 2 liner somewhere, turn into a 1 liner, once |
02:51:49 | FromDiscord | <Elegantbeef> Well then write the code normally and carry on |
02:52:00 | FromDiscord | <Elegantbeef> Dont try to make everything one liners on this quest of "code purity" |
02:52:14 | FromDiscord | <Elegantbeef> you can also do a block statement if you want it immutable |
02:52:15 | FromDiscord | <voidwalker> I cried a bit when I had to disassemble my first glorious mapIt.SplitIt.FuckIt etc :\ |
02:52:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46S1 |
02:52:55 | FromDiscord | <voidwalker> I never used blcoks.. how would this help me .? |
02:53:10 | FromDiscord | <Elegantbeef> It lets you have the variable as an immutable one as i said |
02:56:18 | FromDiscord | <voidwalker> check ths out, this compiles |
02:56:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46S2 |
02:56:42 | FromDiscord | <Elegantbeef> Thanks i hate it |
02:57:09 | FromDiscord | <huantian> 😛 |
02:57:12 | FromDiscord | <voidwalker> but I am getting just `https://www.imdb.com/find?%26exact=true` from $url |
02:57:13 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=46S3 |
02:57:25 | FromDiscord | <huantian> yeah `?` seems to overwrite the existing query |
02:59:12 | FromDiscord | <flywind> In reply to @voidwalker "but I am getting": See https://github.com/nim-lang/Nim/issues/19782 and https://github.com/nim-lang/Nim/pull/19800 review welcome. |
02:59:37 | FromDiscord | <voidwalker> woah, thank you, there's hope |
02:59:42 | FromDiscord | <voidwalker> just gotta switch to nim-git |
03:00:08 | FromDiscord | <voidwalker> Totally worth it for such an important code improvement piece : P |
03:00:48 | FromDiscord | <huantian> well you can just make your own proc that does that |
03:00:56 | FromDiscord | <huantian> at least for now |
03:01:59 | FromDiscord | <voidwalker> hm so that code is not merged yet ? |
03:02:24 | FromDiscord | <huantian> no the pr is still open |
03:04:21 | FromDiscord | <flywind> Giving the PR a thumb up will probably help it merge faster. |
03:09:51 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46S9 |
03:10:01 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=46S9" => "https://play.nim-lang.org/#ix=46Sa" |
03:10:07 | FromDiscord | <voidwalker> so this until the bug squish reaches next version |
03:14:54 | FromDiscord | <Elegantbeef> For now it's probably best to just define your own `??` operator that merges queries like you did |
03:16:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Sb |
03:55:29 | FromDiscord | <voidwalker> ok now I need to pick a html parse lib.. string searching won't cut it here |
03:56:18 | FromDiscord | <Elegantbeef> stdlib has one |
03:57:31 | FromDiscord | <Bung> anyone face libwinpthread-1.dll not found in run time when turn threads on |
03:57:55 | FromDiscord | <Bung> am on win11 |
03:59:59 | FromDiscord | <flywind> In reply to @Bung "anyone face libwinpthread-1.dll not": Yeah, that dll is in the mingw directory and add that directory to your envs. |
04:00:50 | FromDiscord | <flywind> (edit) "directory" => "\bindirectory" |
04:01:00 | FromDiscord | <flywind> (edit) "mingw \bindirectory" => "`mingw\bin` directory" |
04:02:27 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46So |
04:02:30 | FromDiscord | <voidwalker> that is the stdlib htmlparse example |
04:02:42 | FromDiscord | <Bung> In reply to @flywind "Yeah, that dll is": oh thanks, it's under nim-1.6.6\dist\mingw64\bin |
04:03:08 | FromDiscord | <voidwalker> ` <td class="result_text"> <a href="/title/tt0133093/?ref_=fn_tt_tt_1" >Matrix</a> (1999) </td` |
04:03:18 | FromDiscord | <voidwalker> something like this in the html that must be parsed |
04:03:47 | FromDiscord | <Prestige> Pixie mentions it has glowing as a feature, but I don't see anything for it. Anyone know if it's actually a thing? |
04:04:36 | FromDiscord | <Prestige> I suppose I could just use a shadow somehow |
04:04:50 | FromDiscord | <Elegantbeef> Shadow takes colour so yea probably just use shadow |
04:21:10 | FromDiscord | <flywind> Lucky, I found the regression for https://github.com/nim-lang/Nim/issues/16933 at the second guess (it is regression from 1.2 to 1.4 but I don't bother to run a git bisect) |
04:36:16 | FromDiscord | <!&luke> Would wrapping a c lib like libvips be faster than chroma? |
04:36:22 | FromDiscord | <!&luke> (edit) "chroma?" => "pixie?" |
04:36:34 | FromDiscord | <Elegantbeef> Benchmark them |
04:37:08 | FromDiscord | <!&luke> Hmm yeah wrapping the lib will probably help someone if it doesn't work for me |
04:37:22 | FromDiscord | <Elegantbeef> I mean you can use the library in C or another language |
04:37:43 | FromDiscord | <!&luke> Yea but c code would be faster than nims generated version |
04:37:50 | FromDiscord | <Elegantbeef> No it wouldnt |
04:37:55 | FromDiscord | <Rika> Not necessarily |
04:37:55 | FromDiscord | <Elegantbeef> I dont know why people say that |
04:38:02 | FromDiscord | <Elegantbeef> Nim can be as fast as C |
04:38:15 | FromDiscord | <!&luke> In reply to @Elegantbeef "I dont know why": Maybe because the code is a mess 💀 it's computer generated |
04:38:25 | FromDiscord | <Elegantbeef> So fucking what |
04:38:37 | FromDiscord | <Rika> Almost like saying your handwritten ASM code is probably better than the C compiler’s |
04:38:38 | FromDiscord | <!&luke> Nim takes a 10 line fizzbuzz to over 200 lines of js 💀 |
04:38:41 | FromDiscord | <Rika> Most of the time it isn’t |
04:38:52 | FromDiscord | <Elegantbeef> With `-d:danger`?↵(@!&luke) |
04:38:52 | FromDiscord | <Rika> Unless you’re already very very well versed in assembly |
04:39:06 | FromDiscord | <!&luke> In reply to @Elegantbeef "With `-d:danger`? (<@704106773660827690>)": No I have no idea what that does |
04:39:08 | FromDiscord | <Elegantbeef> Also who cares how many lines the code is |
04:39:10 | FromDiscord | <Rika> In reply to @ripluke "Maybe because the code": Simpler is not always faster |
04:39:12 | FromDiscord | <Elegantbeef> It's all about the speed |
04:39:21 | FromDiscord | <huantian> In reply to @ripluke "Nim takes a 10": yeah but I don't die inside multiple times when I write it in nim |
04:39:44 | FromDiscord | <!&luke> In reply to @Rika "Simpler is not always": In interprated code the less lines the interpreter has to interperate the better |
04:40:02 | FromDiscord | <!&luke> Shouldn't matter in c tho |
04:40:26 | FromDiscord | <Rika> This isn’t interpreted code now is it |
04:40:39 | FromDiscord | <!&luke> In reply to @ripluke "Shouldn't matter in c": . |
04:40:56 | FromDiscord | <!&luke> In js it will definitely make a difference |
04:41:35 | FromDiscord | <Rika> No because JS is JIT’ed too |
04:41:53 | FromDiscord | <Elegantbeef> Wow my one line fizzbuzz in nim is 400 loc in JS |
04:41:56 | FromDiscord | <Elegantbeef> Literally unusable |
04:42:16 | FromDiscord | <Rika> Put it through a minifier and it’ll be 1 LOC |
04:42:22 | FromDiscord | <Rika> Easy |
04:42:24 | FromDiscord | <Elegantbeef> Yea that's the joke |
04:42:49 | FromDiscord | <!&luke> Would wrapping the python wrapping of a lib produce a slower result? |
04:43:04 | FromDiscord | <Rika> Most likely because you’re going through Python |
04:43:09 | FromDiscord | <!&luke> In reply to @Rika "Put it through a": Not a very readable 1 line |
04:43:10 | FromDiscord | <Elegantbeef> 6.9kb fizzbuzz, nice |
04:43:19 | FromDiscord | <!&luke> In reply to @Elegantbeef "6.9kb fizzbuzz, nice": Lol |
04:43:21 | FromDiscord | <Elegantbeef> You act like the Nim was readable |
04:43:26 | FromDiscord | <Rika> In reply to @ripluke "Not a very readable": Nim doesn’t intend to produce readable code |
04:43:27 | FromDiscord | <!&luke> In reply to @Elegantbeef "You act like the": It was |
04:43:36 | FromDiscord | <Elegantbeef> That's garbage |
04:43:39 | FromDiscord | <Prestige> With a template, Nim's fizzbuzz can be O(1) runtime |
04:43:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/bV5 |
04:43:43 | FromDiscord | <!&luke> In reply to @Rika "Nim doesn’t intend to": Yea that's why windows defender hates it |
04:43:48 | FromDiscord | <Elegantbeef> Why template?↵(@Prestige) |
04:44:01 | FromDiscord | <huantian> In reply to @ripluke "Yea that's why windows": that's a misguided opinion |
04:44:08 | FromDiscord | <Elegantbeef> Static evaluation exists prestige |
04:44:11 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46Su |
04:44:14 | FromDiscord | <Tuatarian> In reply to @Elegantbeef "You do realize orc": yes, but there is no disadvantage of manually freeing the cycles beyond what you'd expect in c/c++ or any other langauge right? |
04:44:23 | FromDiscord | <!&luke> In reply to @ripluke "Nim or scheme?": Nim can be lisp too |
04:44:26 | FromDiscord | <huantian> unreadable != malware |
04:44:30 | FromDiscord | <Prestige> Yeah my comment was a joke, you could do the same in any language if you typed it all out |
04:44:31 | FromDiscord | <Elegantbeef> No there isnt |
04:44:33 | FromDiscord | <huantian> if it did all js would be malware |
04:44:42 | FromDiscord | <!&luke> In reply to @huantian "unreadable != malware": Windows defender seems to disagree |
04:44:52 | FromDiscord | <Prestige> Windows defender is malware |
04:44:57 | FromDiscord | <!&luke> That's why I don't use windows anymore |
04:45:05 | FromDiscord | <!&luke> In reply to @Avahe "Windows defender is malware": Most windows antivirus is |
04:45:07 | FromDiscord | <Elegantbeef> No prestige i'm saying in nim you can just do `echo static(fizzBuzz(100))` |
04:45:15 | FromDiscord | <huantian> In reply to @ripluke "Windows defender seems to": windows defender doesn't detect it because the c code is unreadable |
04:45:18 | FromDiscord | <huantian> it has no idea what the c code is |
04:45:20 | FromDiscord | <!&luke> In reply to @ripluke "Most windows antivirus is": Norton and macafee definitely are |
04:45:37 | FromDiscord | <huantian> it detects it because the code looks like other malware writien in nim |
04:45:47 | FromDiscord | <!&luke> There is malware in nim? |
04:46:27 | FromDiscord | <Elegantbeef> I think i've successfully made the worlds worst CLI parser |
04:46:31 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1005698426794684456/image.png |
04:47:02 | FromDiscord | <Tuatarian> is this doom emacs? |
04:47:08 | FromDiscord | <huantian> no that's kate |
04:47:16 | FromDiscord | <Elegantbeef> Huan knows what's what |
04:47:19 | FromDiscord | <Tuatarian> looks like doom tbh |
04:47:25 | FromDiscord | <Elegantbeef> It's ayu mirage |
04:47:27 | FromDiscord | <Tuatarian> ie not that good (sorry) |
04:47:35 | FromDiscord | <Elegantbeef> With iosevka |
04:47:39 | FromDiscord | <huantian> hey I like how doom emacs looks |
04:47:40 | FromDiscord | <!&luke> I wish Nim had the zig level of c interop |
04:47:50 | FromDiscord | <Elegantbeef> It's ok you're free to be wrong, just dont tell me how wrong you are |
04:47:51 | FromDiscord | <Elegantbeef> It literally does luke use futhark |
04:47:56 | FromDiscord | <!&luke> In reply to @iWonderAboutTuatara "looks like doom tbh": Default doom cs |
04:48:05 | FromDiscord | <huantian> I like the purple |
04:48:19 | FromDiscord | <!&luke> In reply to @Elegantbeef "It literally does luke": 💀 it's just alot easier in zig |
04:48:25 | FromDiscord | <!&luke> 1 function |
04:48:28 | FromDiscord | <Elegantbeef> ... |
04:48:32 | FromDiscord | <Elegantbeef> It's like 3 lines of code |
04:48:38 | FromDiscord | <!&luke> cInclude("lib") |
04:48:48 | FromDiscord | <Elegantbeef> Seriously futhark is braindead easy |
04:48:50 | FromDiscord | <!&luke> In reply to @Elegantbeef "It's like 3 lines": Ok |
04:49:01 | FromDiscord | <Elegantbeef> assuming you dont hit a bug with it 😄 |
04:49:16 | FromDiscord | <!&luke> Also should I static compile or... |
04:49:32 | FromDiscord | <Elegantbeef> Whatever you want |
04:49:32 | FromDiscord | <huantian> how would you compile at runtime 🙃 |
04:49:44 | FromDiscord | <!&luke> I think vips is a bit to big to static compile |
04:49:52 | FromDiscord | <Elegantbeef> Why do people ask such unimportant questions |
04:50:01 | FromDiscord | <Rika> In reply to @huantian "how would you compile": I think they mean to static link |
04:50:04 | FromDiscord | <Elegantbeef> Static compilation is better for larger libraries |
04:50:10 | FromDiscord | <!&luke> In reply to @Rika "I think they mean": Oh yea |
04:50:30 | FromDiscord | <Elegantbeef> Like... the larger the library the more benefits you get from static linking as your compiler doesnt include unused symbols |
04:50:52 | FromDiscord | <!&luke> What |
04:51:08 | FromDiscord | <!&luke> But your binary would be huge |
04:51:12 | FromDiscord | <Rika> What |
04:51:12 | FromDiscord | <Elegantbeef> No |
04:51:28 | FromDiscord | <Elegantbeef> Static linking reduces the shipped size as it only uses code that you use |
04:51:43 | FromDiscord | <Elegantbeef> A static linked binary is smaller than dynamically linked + binary |
04:51:46 | FromDiscord | <Rika> Static linking also has “DCE” in some form yes |
04:51:50 | FromDiscord | <!&luke> In reply to @Elegantbeef "A static linked binary": Ok |
04:52:04 | FromDiscord | <Rika> In reply to @Elegantbeef "A static linked binary": Unless a lot of binaries use the same library |
04:52:20 | FromDiscord | <Elegantbeef> I'm imagining a windows world where no one knows what the purpose of dynamic libraries are |
04:53:00 | FromDiscord | <Rika> You mean |
04:53:02 | FromDiscord | <Rika> Now |
04:53:28 | FromDiscord | <Prestige> I love static linking |
04:54:23 | FromDiscord | <Elegantbeef> I'm completely indifferent |
04:56:16 | FromDiscord | <!&luke> In reply to @Elegantbeef "I'm imagining a windows": Isn't that what a dll is |
04:56:30 | FromDiscord | <Elegantbeef> No one in the windows world understands dlls |
04:56:49 | FromDiscord | <Elegantbeef> They're practically static libraries that are dynamically linked |
04:57:56 | FromDiscord | <Elegantbeef> The point of dynamic linking if file reuse but most windows applications ship their own libraries so there is -10 reuse |
04:58:45 | FromDiscord | <huantian> yeah they have to ship their own because dlls have 0 versioning |
04:59:02 | FromDiscord | <huantian> or rather you can only use one version at a time right? |
04:59:05 | * | madprops checks out https://nim-lang.org/docs/asynchttpserver.html |
04:59:09 | FromDiscord | <Elegantbeef> No fucking clue |
04:59:16 | FromDiscord | <Rika> In reply to @madprops "checks out https://nim-lang.org/docs/asynchttpserve": ? |
04:59:32 | madprops | oh i used /me |
04:59:44 | FromDiscord | <huantian> ah |
04:59:51 | FromDiscord | <huantian> why is that not bridged to discord |
05:07:36 | FromDiscord | <j-james> In reply to @Elegantbeef "It's like 3 lines": futhark is ridiculously easy |
05:07:46 | FromDiscord | <Forest> Working on creating Nim bindings for WGPU |
05:08:13 | FromDiscord | <j-james> it's just that, you don't usually want 1:1 perfect c interop because c function names fucking suck lmfao |
05:10:07 | FromDiscord | <Forest> Can futhark output a Nim file from a header file i give it? |
05:14:45 | FromDiscord | <Rika> Technically yeah |
05:15:33 | FromDiscord | <j-james> but every other line is a `when` statement |
05:16:23 | FromDiscord | <Forest> In reply to @Rika "Technically yeah": Technically? |
05:16:33 | FromDiscord | <Forest> In reply to @j-james "but every other line": Is that an issue? |
05:17:14 | FromDiscord | <Elegantbeef> It's not really an isssue |
05:17:32 | FromDiscord | <j-james> yes if you want to use it for the basis of a more idiomatic wrapper |
05:17:35 | FromDiscord | <Elegantbeef> https://github.com/beef331/miniaudio/blob/master/src/miniaudio.nim#L5-L8 generates https://github.com/beef331/miniaudio/blob/master/src/miniaudio/futharkminiaudio.nim inside your nimcache |
05:17:36 | FromDiscord | <j-james> no if you just want c interop |
05:17:54 | FromDiscord | <Elegantbeef> It's not that big of an issue james you can just use templates/procs on top of it |
05:18:52 | FromDiscord | <Forest> In reply to @j-james "yes if you want": Ah i do though |
05:19:06 | FromDiscord | <Forest> In reply to @Elegantbeef "https://github.com/beef331/miniaudio/blob/master/sr": Ah thanks Elegantbeef! |
05:19:08 | FromDiscord | <Elegantbeef> My miniaudio wrapper there is idiomatic Nim code |
05:19:53 | FromDiscord | <j-james> In reply to @Elegantbeef "It's not that big": oh i suppose that's true yeah |
05:19:59 | FromDiscord | <j-james> probably a better way to do it |
05:20:51 | FromDiscord | <Forest> Do ya not need to import futhark before using importc? |
05:21:09 | FromDiscord | <Elegantbeef> You do |
05:21:15 | FromDiscord | <Elegantbeef> I just forgot to inside that when branch |
05:21:59 | FromDiscord | <Forest> Ah okay lmao |
05:22:11 | FromDiscord | <Forest> Thanks for the help! |
05:22:59 | FromDiscord | <xzntrc> in `proc bar(): int = 3` what does everything after the `:` mean? |
05:23:34 | FromDiscord | <xzntrc> not really sure how procs work |
05:23:47 | FromDiscord | <Prestige> int is the return type |
05:24:18 | FromDiscord | <Prestige> Everything after `=` is code that's executed, in this case the proc just returns 3 |
05:24:46 | FromDiscord | <xzntrc> and `proc fibonacci(n: int):` |
05:24:50 | FromDiscord | <xzntrc> so the n inside is the input? |
05:24:55 | FromDiscord | <Prestige> Yep |
05:24:56 | FromDiscord | <Elegantbeef> It's a parameter yes |
05:25:15 | FromDiscord | <Elegantbeef> `proc name[GenericParameters](parameters): returnType = body` |
05:26:11 | FromDiscord | <xzntrc> do procs have to have a return? |
05:26:47 | FromDiscord | <Elegantbeef> No |
05:27:07 | FromDiscord | <Elegantbeef> Procs dont need `[GenericParameters](parameters): returntype` |
05:27:11 | FromDiscord | <Elegantbeef> They need a name and body though |
05:27:33 | FromDiscord | <xzntrc> ohhh |
05:27:40 | FromDiscord | <xzntrc> this is valid? |
05:27:44 | FromDiscord | <xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46SI |
05:27:59 | FromDiscord | <Prestige> Yep |
05:28:22 | FromDiscord | <that_dude> Isn't there an eval bot in this channel? |
05:28:31 | FromDiscord | <Prestige> There is, yeah |
05:28:40 | FromDiscord | <Prestige> @xzntrc check out https://nim-lang.org/documentation.html |
05:29:09 | FromDiscord | <Prestige> !eval echo "The bot is alive" |
05:29:13 | NimBot | The bot is alive |
05:29:45 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=46SM |
05:30:18 | FromDiscord | <that_dude> F |
05:30:19 | FromDiscord | <Prestige> Wonder if it doesn't work with multiple lines |
05:30:20 | FromDiscord | <Elegantbeef> It only works with single lines since it's on IRC |
05:30:54 | FromDiscord | <Prestige> Maybe we should turn it into a discord bot |
05:31:23 | FromDiscord | <Elegantbeef> Feel free it just uses nim playground's api so it's easy enough |
05:31:38 | FromDiscord | <Prestige> Neat |
05:50:10 | FromDiscord | <xzntrc> oh yeah, guessing there is no API wrapper for nim yet? |
05:50:12 | FromDiscord | <xzntrc> for discord i mean |
05:50:23 | FromDiscord | <Elegantbeef> https://github.com/krisppurg/dimscord |
05:52:26 | FromDiscord | <xzntrc> neat |
05:52:49 | FromDiscord | <xzntrc> oh also, question, is it good practice to write in seperate files? Like classes in java |
05:52:59 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46SO |
05:53:05 | FromDiscord | <Elegantbeef> Nim files are modules, use modules as much as makes sense |
05:53:20 | FromDiscord | <voidwalker> $a.attrs["href"] yields `/title/tt4167406/?ref_=fn_tt_tt_46` |
05:53:32 | FromDiscord | <voidwalker> how to get the next part ? the title/ year |
05:53:54 | * | xcodz-dot joined #nim |
05:54:16 | FromDiscord | <Forest> The generated futhark file should be fine to distribute, right? |
05:54:17 | FromDiscord | <Elegantbeef> the title is the innertext of the node |
05:54:23 | FromDiscord | <Elegantbeef> Yea |
05:54:27 | FromDiscord | <Forest> Sweet |
05:55:45 | xcodz-dot | Just wondering, from which timezone are most nim people are in this community cause I being in India, have a near 12-hour difference from america |
05:56:05 | FromDiscord | <xzntrc> im from australia myself. |
05:56:24 | FromDiscord | <Forest> I'm fron England |
05:56:30 | FromDiscord | <Forest> A true British lass |
05:56:32 | FromDiscord | <Elegantbeef> Canada here |
05:56:39 | FromDiscord | <voidwalker> Indeed a itself yields `<a href="/title/tt0328832/?ref_=fn_tt_tt_9">The Animatrix</a>` |
05:57:36 | xcodz-dot | So its morning here while its late night in Canada? |
05:58:09 | FromDiscord | <xzntrc> timezones suck honestly |
05:58:12 | FromDiscord | <xzntrc> it's 3PM here |
05:58:24 | xcodz-dot | 11:30 AM |
05:58:24 | FromDiscord | <Elegantbeef> It's 0\:00 in 2 minutes for me so yes |
06:00:07 | FromDiscord | <xzntrc> i'm assuming I dont need to specify a main proc right? |
06:00:16 | FromDiscord | <Elegantbeef> Top level code is allowed yes |
06:00:22 | FromDiscord | <Elegantbeef> Consider looking at the official tutorials |
06:00:28 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html |
06:00:41 | FromDiscord | <xzntrc> right sorry |
06:01:32 | xcodz-dot | Any opinions on Nimble as it seems to be one of the reasons that other languages do better. |
06:01:39 | xcodz-dot | in my opinion* |
06:02:11 | FromDiscord | <ajusa> do folks have a preference for testing framework? I was looking at treeform/guzba code and it seems like they just have blocks with asserts rather than using unittest |
06:03:48 | FromDiscord | <Prestige> I wrote my own mini testing framework because I didn't like the others |
06:04:36 | FromDiscord | <Elegantbeef> Balls is well regarded↵(@ajusa) |
06:05:27 | FromDiscord | <ajusa> balls looks pretty interesting |
06:05:52 | FromDiscord | <Elegantbeef> You really had to make the joke didnt you |
06:06:09 | FromDiscord | <ajusa> joke? |
06:09:46 | FromDiscord | <xzntrc> kek |
06:10:15 | xcodz-dot | cake? |
06:10:36 | FromDiscord | <xzntrc> ? |
06:10:43 | xcodz-dot | kek -> Cake? |
06:10:53 | xcodz-dot | what's kek? |
06:11:08 | xcodz-dot | m new to online chat |
06:11:10 | FromDiscord | <xzntrc> ohh |
06:11:15 | FromDiscord | <xzntrc> it's yeah thats fine |
06:11:18 | FromDiscord | <Elegantbeef> It's just a variation of lol practically |
06:11:22 | FromDiscord | <xzntrc> yep ^ |
06:11:50 | FromDiscord | <xzntrc> it's a term from world of warcraft |
06:12:10 | xcodz-dot | well, as bad as it is, I do not play any games |
06:12:25 | xcodz-dot | the most boring of lifes as you could imagine |
06:12:53 | FromDiscord | <xzntrc> ah nah I quit playing games a while ago |
06:12:57 | FromDiscord | <xzntrc> for the most part. |
06:13:33 | madprops | im playing the swapper |
06:13:42 | madprops | nice puzzle game |
06:14:04 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46ST |
06:14:08 | FromDiscord | <voidwalker> ok so I found the innerText proc, it works |
06:14:15 | FromDiscord | <voidwalker> but how about the year ? what element is that ? |
06:15:02 | xcodz-dot | @madprops Are ya from IRC? |
06:15:26 | madprops | yeah im here |
06:15:44 | FromDiscord | <Elegantbeef> It might just be the text for the element above the a |
06:15:50 | FromDiscord | <Rika> In reply to @voidwalker "but how about the": It’s outside of the a node |
06:16:10 | madprops | xcodz-dot, sup? |
06:16:43 | FromDiscord | <voidwalker> @Rika I noticed that.. but can it be pointed by some element or somehow ? |
06:16:58 | FromDiscord | <Elegantbeef> might be `.text` of the parent element |
06:20:12 | FromDiscord | <Forest> Question: How would i work on making a wrapper around a big C library that's i wanna wrap to be more Nim-like? |
06:20:33 | FromDiscord | <Elegantbeef> You start abstracting the procedures to fit with more nim code |
06:20:49 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L42 example of this here |
06:21:58 | FromDiscord | <voidwalker> is there any way I can enumerate all this xml node thingie, in a structured way? So I can see what keeps what |
06:22:13 | FromDiscord | <Elegantbeef> There are iterators |
06:22:35 | FromDiscord | <Elegantbeef> There's also find all and similar |
06:22:36 | FromDiscord | <voidwalker> as xml file no? |
06:22:49 | FromDiscord | <Elegantbeef> You parse the xml file then can interate the xml tree |
06:22:55 | FromDiscord | <Elegantbeef> iterate rather |
06:23:46 | FromDiscord | <Forest> In reply to @Elegantbeef "https://github.com/beef331/wasmedge_playground/blob": That was wrapped with futhark? |
06:23:53 | FromDiscord | <Elegantbeef> Yes |
06:24:07 | FromDiscord | <Forest> And generated futhark files in the future, as long as there's no major API breakages, should continue working? |
06:24:15 | FromDiscord | <Elegantbeef> Sure |
06:24:32 | FromDiscord | <Forest> Sweet |
06:25:29 | FromDiscord | <xzntrc> getting the hang of nim now |
06:27:11 | FromDiscord | <xzntrc> wait |
06:27:15 | FromDiscord | <xzntrc> why does this not discard? |
06:27:26 | FromDiscord | <xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46SX |
06:27:34 | FromDiscord | <Rika> What do you mean |
06:27:40 | FromDiscord | <Elegantbeef> discard isnt break |
06:27:59 | FromDiscord | <Elegantbeef> `discard` is "I dont care about this value" or "here indent overlord here's a statement to parse, dont hurt me" |
06:28:49 | FromDiscord | <xzntrc> ohh |
06:28:54 | FromDiscord | <xzntrc> I thought discard broke out |
06:29:05 | FromDiscord | <Elegantbeef> No `break` breaks |
06:35:14 | FromDiscord | <xzntrc> right lol sorry |
06:35:33 | FromDiscord | <xzntrc> wait so what is an appropriate use of discared? |
06:35:34 | FromDiscord | <xzntrc> (edit) "discared?" => "discard" |
06:35:36 | FromDiscord | <xzntrc> (edit) "discard" => "discard?" |
06:36:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T3 |
06:36:29 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html#procedures-discard-statement |
06:39:16 | xcodz-dot | if you know Python, "pass" ~= "discard" |
06:39:26 | FromDiscord | <xzntrc> ahhh right thanks |
06:39:45 | FromDiscord | <Elegantbeef> It has one more semantic but yea |
06:41:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T5 |
06:42:03 | FromDiscord | <Elegantbeef> so you need to use `discard` before any value you dont want |
06:42:32 | xcodz-dot | any linux user here? |
06:42:40 | FromDiscord | <Elegantbeef> Of course |
06:42:50 | xcodz-dot | which one? |
06:43:02 | FromDiscord | <xzntrc> Arch personally. |
06:43:04 | FromDiscord | <Elegantbeef> debian sid |
06:43:22 | xcodz-dot | Desktop Environment? |
06:43:33 | FromDiscord | <xzntrc> I use gnome |
06:43:45 | FromDiscord | <Elegantbeef> Same presently |
06:43:56 | FromDiscord | <4zv4l> how can I make a simpler function that takes two string and return a reference to the longest string ? |
06:44:00 | FromDiscord | <xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005727994121306152/unknown.png |
06:44:02 | xcodz-dot | wdym ElegantBeef, what do you prefer? |
06:44:06 | FromDiscord | <4zv4l> it's more for the keyword that I ask |
06:44:21 | FromDiscord | <Elegantbeef> I prefer tiling window managers |
06:44:41 | FromDiscord | <Elegantbeef> Simpler to what? |
06:44:50 | FromDiscord | <xzntrc> i like i3 but never had the time to config |
06:46:49 | FromDiscord | <j-james> In reply to @xzntrc "": ayy dash-to-panel |
06:48:55 | xcodz-dot | @4zv4l I personally do not think that something so specific exists. |
06:48:56 | FromDiscord | <Elegantbeef> What are you after?↵(@4zv4l) |
06:49:21 | FromDiscord | <4zv4l> something like this but |
06:49:23 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T6 |
06:49:26 | FromDiscord | <4zv4l> it tells me that's it's not correct |
06:49:38 | FromDiscord | <Elegantbeef> Of course it's not you cannot make a stack variable a `ref` |
06:49:47 | FromDiscord | <Elegantbeef> Nim strings are value semantics |
06:50:03 | FromDiscord | <Elegantbeef> So you'd need to declare your strings as `ref string` if you wanted to have a reference to them |
06:50:12 | FromDiscord | <xzntrc> do fstrings exist? |
06:50:21 | FromDiscord | <4zv4l> In reply to @Elegantbeef "So you'd need to": in the function arguments ? |
06:50:24 | FromDiscord | <Elegantbeef> `std/strformat` |
06:50:49 | FromDiscord | <xzntrc> so is there anything like %f |
06:51:00 | FromDiscord | <4zv4l> In reply to @Elegantbeef "So you'd need to": alright seems to more but then I can't use the `len()` function on them anymore |
06:51:14 | xcodz-dot | @xzntrc |
06:51:16 | xcodz-dot | yes |
06:51:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T7 |
06:51:32 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html#advanced-types-reference-and-pointer-types |
06:51:58 | * | xcodz-dot quit (Quit: Leaving) |
06:52:13 | FromDiscord | <4zv4l> why do I need to add [] to get their value ? |
06:52:53 | FromDiscord | <Elegantbeef> std/strformat↵(@xzntrc) |
06:53:11 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/lib.html |
06:53:17 | FromDiscord | <Elegantbeef> They're references |
06:53:30 | FromDiscord | <Elegantbeef> Read the link i sent you before asking any more questions |
06:53:40 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T8 |
06:55:10 | FromDiscord | <Elegantbeef> Well nim's strings are considered value types and nim doesnt have views(rust borrowing) working presently so it's what you get when you want a reference |
06:55:58 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T9 |
06:56:01 | FromDiscord | <4zv4l> the C version is much more shorter and understandable |
06:56:06 | FromDiscord | <4zv4l> I just wanna do the same in Nim |
06:56:14 | FromDiscord | <Elegantbeef> Nim is safer than C |
06:57:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Ta |
06:57:41 | FromDiscord | <Elegantbeef> If you dont care about safety you can get a pointer to the string |
06:57:53 | FromDiscord | <Elegantbeef> But it's highly discouraged as it's supremely easy to have issues |
06:57:57 | FromDiscord | <valerga> are airplanes with embedded nim safer than c? |
06:58:12 | FromDiscord | <4zv4l> xD |
06:58:17 | FromDiscord | <Elegantbeef> Probably a tinge |
06:58:41 | FromDiscord | <Prestige> I never board an airplane unless it's running NIm instead of C |
06:58:43 | FromDiscord | <Elegantbeef> Do not by default have null terminated strings and dont get dangling pointers |
06:59:02 | FromDiscord | <Elegantbeef> Eh i dont board a plane unless it runs ada sparks |
06:59:25 | FromDiscord | <Prestige> Remember, never board a rusty airplane |
06:59:32 | FromDiscord | <4zv4l> xD |
06:59:58 | FromDiscord | <Elegantbeef> Point being 4zv4l yes the C way is simpler but the C way is also more unsafe |
07:00:20 | FromDiscord | <Elegantbeef> You do not know where the pointer you got came from so you do not know if it's safe to do `dealloc` on it |
07:00:23 | FromDiscord | <Elegantbeef> It might be a stack variable |
07:00:32 | FromDiscord | <Elegantbeef> In this case it is |
07:00:45 | FromDiscord | <Prestige> Isn't there a way to pass strings by address rather than having it do a copy? |
07:00:51 | FromDiscord | <Prestige> without having to do what you did |
07:00:54 | FromDiscord | <Elegantbeef> `toOpenArray` |
07:01:16 | FromDiscord | <Elegantbeef> cursor inference does exist so with arc/orc assignment will move data generally |
07:01:40 | FromDiscord | <Prestige> I was thinking like `{.byaddr.}` but I don't recall how it actually functions |
07:01:50 | FromDiscord | <4zv4l> In reply to @Elegantbeef "It might be a": what's wrong with stack variable ? the string is given in argument so if the function before called the longest() one giving those string↵the strings are valid at least until the longest() return |
07:01:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Tb |
07:02:05 | FromDiscord | <4zv4l> (edit) "string↵the" => "strings↵the" |
07:02:48 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Td |
07:02:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Te |
07:03:04 | FromDiscord | <Elegantbeef> God damn it |
07:03:23 | FromDiscord | <4zv4l> you don't need to cast malloc in C btw (long discussion I know) |
07:03:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Tf |
07:03:46 | FromDiscord | <Elegantbeef> Cool but that doesnt change the argument |
07:04:00 | FromDiscord | <Elegantbeef> The C code is inheritly unsafe as you do not know if it's a static/stack/heap value |
07:04:02 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Tg |
07:04:05 | FromDiscord | <Elegantbeef> It's C code so clearly it's bad |
07:04:08 | FromDiscord | <4zv4l> it's not C that is unsafe |
07:04:11 | FromDiscord | <4zv4l> your code is unsafe |
07:04:25 | FromDiscord | <Elegantbeef> It's C that is unsafe as it doesnt distinguish anything |
07:04:29 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Th |
07:04:38 | FromDiscord | <Elegantbeef> Your argument is invalid cause it compiles without looking off |
07:04:50 | FromDiscord | <4zv4l> because the programmer is supposed to think |
07:04:54 | FromDiscord | <Elegantbeef> ... |
07:05:23 | FromDiscord | <4zv4l> that's better |
07:05:27 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Ti |
07:05:44 | FromDiscord | <4zv4l> C is not unsafe, programmer are unsafe |
07:06:12 | FromDiscord | <4zv4l> that's the difference between new languages that takes programmers for idiots and check everything for them (like Rust for example) |
07:06:23 | FromDiscord | <4zv4l> C is not unsafe, it's a tool, it's the way you use it that is unsafe |
07:07:23 | FromDiscord | <Elegantbeef> cool it's also still going to error |
07:07:24 | FromDiscord | <Elegantbeef> Ok whatever |
07:08:28 | FromDiscord | <Elegantbeef> Ok |
07:08:30 | FromDiscord | <Elegantbeef> It's a terrible language with a terrible type system, so i dont really care about the technicalities |
07:09:17 | FromDiscord | <4zv4l> you cannot tell bad from a language that is that old |
07:09:23 | FromDiscord | <exelotl> I'm with beef on this one, we have decades of evidence to show that even the smartest programmers can't reliably write C code without security holes |
07:09:25 | FromDiscord | <4zv4l> they did what they could with the experience they had |
07:09:39 | FromDiscord | <Elegantbeef> No you cant argue that |
07:09:40 | FromDiscord | <Elegantbeef> Pascal literally existed |
07:09:44 | FromDiscord | <exelotl> ^ |
07:09:49 | FromDiscord | <Elegantbeef> Like fuck off with the age argument |
07:09:56 | FromDiscord | <Elegantbeef> Pascal is as old as C but doesnt have nearly as many flaws |
07:10:02 | FromDiscord | <4zv4l> well |
07:10:12 | FromDiscord | <4zv4l> why did everyone took C over Pascal if Pascal was that good ? |
07:10:15 | FromDiscord | <Rika> Bet he’s gonna pull out the “ |
07:10:16 | FromDiscord | <Rika> Yeah |
07:10:16 | FromDiscord | <Elegantbeef> Cause it has a better type system and more intelligently designed language |
07:10:27 | FromDiscord | <Elegantbeef> Cause Unix was written in C and it became the defacto OS base |
07:10:28 | FromDiscord | <xzntrc> language please guys :( |
07:10:31 | FromDiscord | <Rika> In reply to @4zv4l "why did everyone took": Because Unix took C and everyone went with that |
07:10:42 | FromDiscord | <Prestige> In reply to @xzntrc "language please guys :(": Nim |
07:11:01 | FromDiscord | <Prestige> beta > vhs |
07:11:02 | FromDiscord | <Elegantbeef> xzntrc i swear a lot if you dont like it i guess i'm sorry |
07:11:10 | FromDiscord | <xzntrc> nah im kidding |
07:11:12 | FromDiscord | <Prestige> classic canada |
07:11:30 | FromDiscord | <xzntrc> well i'm finally converting my shell to nim! |
07:11:33 | FromDiscord | <Rika> In reply to @Elegantbeef "xzntrc i swear a": No fuck you smh |
07:11:37 | FromDiscord | <xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46Tj |
07:11:49 | FromDiscord | <Rika> Have you looked at the terminal module |
07:11:56 | FromDiscord | <Elegantbeef> xzntrc look in `terminal` for making your escape code disappear |
07:11:56 | FromDiscord | <xzntrc> yes, why? |
07:11:57 | FromDiscord | <Elegantbeef> Fuck you rika |
07:12:02 | FromDiscord | <Prestige> Lmao |
07:12:03 | FromDiscord | <Elegantbeef> You god damn well know what i was going to say |
07:12:10 | FromDiscord | <xzntrc> fuck you both |
07:12:13 | FromDiscord | <Rika> Yeah your brain too slow |
07:12:19 | FromDiscord | <Rika> In reply to @xzntrc "fuck you both": No thanks |
07:12:23 | FromDiscord | <Prestige> This is the kinda chat I like to see |
07:12:43 | FromDiscord | <Elegantbeef> Anyway for the Pascal vs C argument look at `myStruct` in C what does that mean? |
07:12:46 | FromDiscord | <xzntrc> `getCurrentDir()` returns `/home/xzntrc/Documents/nim`, I couldn't find a way to return just the end (`nim`) |
07:12:46 | FromDiscord | <Elegantbeef> It's a simple question 😄 |
07:13:10 | FromDiscord | <Elegantbeef> `getCurrentDir().splitPath.tail` |
07:13:22 | FromDiscord | <xzntrc> oh thanks bro |
07:13:30 | FromDiscord | <xzntrc> I feel like im leaching off you guys to make this |
07:13:32 | FromDiscord | <Rika> “I’m not your bro, pal” |
07:13:38 | FromDiscord | <Elegantbeef> You are being spoonfed |
07:13:57 | FromDiscord | <Rika> Ditch the spoon eat with your hands |
07:14:00 | FromDiscord | <xzntrc> Yeah I'm sorry, I don't like spoonfeeding. It's just the docs are so long, and I only have limited time left to this weekend. |
07:14:23 | FromDiscord | <Prestige> The searchability isn't great imo |
07:14:39 | FromDiscord | <Prestige> So we just beef as our AI to ask random questions |
07:15:07 | FromDiscord | <Elegantbeef> I mean i'd argue but clearly i dont have any intelligence so it must be artificially imposed |
07:15:24 | FromDiscord | <xzntrc> kek |
07:15:36 | FromDiscord | <Rika> I am a part of beef which is why I can answer at least as well as him |
07:15:49 | FromDiscord | <Elegantbeef> Ah explains the small wee-wee |
07:16:03 | FromDiscord | <xzntrc> what has this chat descended to |
07:16:08 | FromDiscord | <Elegantbeef> Dick jokes |
07:16:13 | FromDiscord | <Elegantbeef> Robin williams would be proud |
07:16:15 | FromDiscord | <Rika> You’ve seen??? |
07:16:28 | FromDiscord | <xzntrc> guys, I'm a minor. |
07:16:29 | FromDiscord | <Prestige> Beef always carries a magnifying glass |
07:16:43 | FromDiscord | <Elegantbeef> Never know when i might run into you↵(@Prestige) |
07:16:51 | FromDiscord | <xzntrc> massive rule violation here guys!! |
07:16:53 | FromDiscord | <xzntrc> `- No pornographic, disturbing, or any other content that can be considered as questionable or NSFW.` |
07:17:14 | FromDiscord | <Elegantbeef> Hey it says no disturbing, i havent post a selfie |
07:17:17 | FromDiscord | <Prestige> Where did you read that |
07:17:24 | FromDiscord | <xzntrc> In reply to @Avahe "Where did you read": in the fucking rules? |
07:17:37 | FromDiscord | <Prestige> Holy shit, there are rules? |
07:17:48 | FromDiscord | <Rika> Prestige’s getting banned |
07:18:00 | FromDiscord | <Rika> It was nice knowing you |
07:18:06 | FromDiscord | <xzntrc> In reply to @Avahe "Holy shit, there are": >quickly deletes all mentions of racism |
07:18:26 | FromDiscord | <Rika> In reply to @xzntrc ">quickly deletes all mentions": Sus |
07:18:29 | FromDiscord | <Prestige> rip |
07:19:02 | FromDiscord | <Prestige> I actually never noticed the rules channel, gotta check this out |
07:19:32 | FromDiscord | <Prestige> `- Use common sense.` |
07:19:37 | FromDiscord | <Prestige> Half the chat about to get banned |
07:19:42 | FromDiscord | <Rika> Ah fuck |
07:19:46 | FromDiscord | <Rika> See y’all |
07:19:49 | FromDiscord | <xzntrc> can we atone for our sins |
07:19:50 | FromDiscord | <Elegantbeef> Jonestown it is |
07:20:17 | FromDiscord | <Rika> Take refuge in the disruptek channel |
07:20:39 | FromDiscord | <xzntrc> one of my friends recently started making a language, I wanna personally make one soon |
07:21:01 | FromDiscord | <Rika> It’s hard if you’re aiming for viability for everyday use |
07:21:06 | FromDiscord | <xzntrc> yeah :( |
07:21:13 | FromDiscord | <Prestige> Good learning experience I bet |
07:21:25 | FromDiscord | <Elegantbeef> Just name it carbon↵(@Rika) |
07:21:42 | FromDiscord | <Rika> Naming my next language Carbide |
07:21:43 | FromDiscord | <xzntrc> haha |
07:21:54 | FromDiscord | <Prestige> Carboff |
07:22:03 | FromDiscord | <Elegantbeef> Fork nim add curlies call it carbide |
07:22:41 | FromDiscord | <Elegantbeef> What happened to the pascal argument |
07:22:44 | FromDiscord | <Rika> Fork Nim add curries call it Nin short for nincompoop |
07:22:45 | FromDiscord | <Elegantbeef> It was going to be so fun |
07:22:56 | FromDiscord | <Elegantbeef> Also rika re you proud of me i now instinctively write argument |
07:23:08 | FromDiscord | <Rika> Congrations |
07:23:33 | FromDiscord | <Elegantbeef> Tanks |
07:23:48 | FromDiscord | <Prestige> I guess you won |
07:23:59 | FromDiscord | <Elegantbeef> I'll be dick twirling if anyone needs me |
07:24:11 | FromDiscord | <Prestige> don't lose the tweezers |
07:24:16 | FromDiscord | <Rika> Beef is just a watered down Disruptek |
07:24:27 | FromDiscord | <Prestige> I miss that guy |
07:25:17 | FromDiscord | <Rika> He was fun but I could also see him having scared off a lot of new people lol |
07:26:10 | FromDiscord | <Elegantbeef> cannot tell if i should be offended or complimented↵(@Rika) |
07:26:15 | FromDiscord | <Prestige> If people are scared off by mildly strong language, I don't really consider it a loss |
07:29:08 | FromDiscord | <Elegantbeef> Eh i help more than i scare i'd hope |
07:29:30 | FromDiscord | <xzntrc> just confusing why procs use `=` but whiles and shit use `:` |
07:29:34 | FromDiscord | <xzntrc> just seems inconsistent |
07:30:14 | FromDiscord | <Prestige> `=` is for assignment |
07:30:25 | FromDiscord | <Elegantbeef> We'll go with `proc a(): ` is ambiguous if it's type or body |
07:30:51 | FromDiscord | <xzntrc> right |
07:30:58 | FromDiscord | <xzntrc> so why doesn't it use curly braces tho |
07:31:12 | FromDiscord | <Elegantbeef> Why would it? |
07:31:12 | FromDiscord | <Prestige> was just a style choice |
07:31:16 | FromDiscord | <xzntrc> alg alg |
07:31:21 | FromDiscord | <Prestige> but think of `=` as assignment for the proc |
07:31:23 | FromDiscord | <xzntrc> also, has anyone made a shell already for nim? |
07:31:27 | FromDiscord | <Rika> I believe so |
07:31:36 | FromDiscord | <Elegantbeef> https://github.com/search?q=shell+language%3Anim |
07:31:39 | FromDiscord | <Elegantbeef> Cmon people! |
07:31:40 | FromDiscord | <Rika> I feel like I recall someone asking similar questions to you |
07:34:10 | FromDiscord | <Prestige> Elegantbeef: How's your game coming? |
07:34:28 | FromDiscord | <Elegantbeef> I havent wrote any code for a few weeks now |
07:34:31 | FromDiscord | <xzntrc> In reply to @Elegantbeef "https://github.com/search?q=shell+language%3Anim": those arent like shells like bash and shit tho |
07:34:32 | FromDiscord | <Elegantbeef> So... not |
07:34:41 | FromDiscord | <xzntrc> for example the top most one is a repl |
07:34:57 | FromDiscord | <xzntrc> alr |
07:35:23 | FromDiscord | <Prestige> Dang, I was hoping to see a finished game sometime |
07:35:30 | FromDiscord | <Elegantbeef> Ok i should say i havent wrote any code that's actually significant anytime recently |
07:35:44 | FromDiscord | <Prestige> I'm porting one of my games from Godot to my engine in nim, nearly finished |
07:35:53 | FromDiscord | <Elegantbeef> Brag about it why dont you |
07:36:31 | FromDiscord | <Elegantbeef> I did write that shitty CLI parser, but aside from that it's pretty much a barren month of lacking want to code |
07:36:34 | FromDiscord | <xzntrc> oh yeah shit I got an assignment coming up for IST class, have to make a game |
07:36:34 | FromDiscord | <Prestige> I want to move on to a project that I'll actually be marketing, going to be a long term project |
07:36:44 | FromDiscord | <xzntrc> should make it in nim when I'm not retarded |
07:38:25 | FromDiscord | <Prestige> Could be a good way to learn nim |
07:38:49 | FromDiscord | <Elegantbeef> Aw shit you're thinking of learning how to write Nim prestige?! |
07:39:06 | FromDiscord | <Prestige> Lol |
07:39:11 | FromDiscord | <Prestige> Every day, beef |
07:40:54 | FromDiscord | <valerga> smoke beef erryday |
07:41:08 | FromDiscord | <Elegantbeef> Even though it's legal no i dont |
07:42:10 | FromDiscord | <valerga> having a "everything is invented" moment |
07:42:38 | FromDiscord | <valerga> but then i'll read some HN post of something really clever |
07:51:14 | * | rockcavera quit (Remote host closed the connection) |
07:58:17 | FromDiscord | <untoreh> why does this deadlocks sometimes? |
07:58:20 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=46To |
07:58:46 | FromDiscord | <untoreh> (edit) "deadlocks" => "deadlock" |
08:02:03 | FromDiscord | <Elegantbeef> Why are you using async instead of just a channel? |
08:02:55 | FromDiscord | <untoreh> this is like, middleware for an async server |
08:03:41 | FromDiscord | <Elegantbeef> Well you return an address to a sequence which is going to get GC'd on function exit |
08:04:00 | FromDiscord | <Elegantbeef> So this is why we avoid `ptr` |
08:04:14 | FromDiscord | <untoreh> initially it was ptrless |
08:04:19 | FromDiscord | <untoreh> same thing |
08:04:31 | FromDiscord | <Elegantbeef> So you made it more complicated to share |
08:04:46 | FromDiscord | <untoreh> it was just the last iteration :S |
08:06:22 | FromDiscord | <Elegantbeef> You have no lock on `qin` but use it from the main thread and secondary thread |
08:07:20 | FromDiscord | <Elegantbeef> Same with qout |
08:08:15 | FromDiscord | <Elegantbeef> Also worth noting using Async stuff across threads like this probably doesnt work |
08:08:57 | FromDiscord | <Elegantbeef> I dont know what the AsyncQueues are so cannot say for certainty |
08:09:00 | FromDiscord | <Elegantbeef> This is just all very suspect code |
08:09:16 | FromDiscord | <xzntrc> is there an appropriate way to write configs? |
08:09:23 | FromDiscord | <xzntrc> I know in rust they use TOML |
08:09:28 | FromDiscord | <xzntrc> in js they use JSON, obviously. |
08:09:30 | FromDiscord | <Elegantbeef> Nim uses nimscript |
08:09:39 | FromDiscord | <PyryTheBurger> how do i get all files in a directory |
08:09:39 | FromDiscord | <Elegantbeef> `config.nims` |
08:09:45 | FromDiscord | <PyryTheBurger> the number of files |
08:09:50 | FromDiscord | <Elegantbeef> `walkDir` inside of os↵(@PyryTheBurger) |
08:10:07 | FromDiscord | <xzntrc> ty beef |
08:10:21 | FromDiscord | <valerga> beef just answered like 3 questions in 30 seconds |
08:10:39 | FromDiscord | <xzntrc> godspeed |
08:10:58 | FromDiscord | <Elegantbeef> Yea it's what i do val |
08:11:12 | FromDiscord | <xzntrc> wow I think this shell is gonna be a piece of cake |
08:11:21 | FromDiscord | <xzntrc> might replace bash with it on my laptop after im done |
08:12:22 | FromDiscord | <valerga> you're writing a shell? |
08:12:34 | FromDiscord | <valerga> i think fish is fine enough |
08:12:46 | FromDiscord | <Elegantbeef> A fellow fish enjoyer |
08:13:01 | FromDiscord | <xzntrc> NOOO |
08:13:10 | FromDiscord | <xzntrc> I still wanna try it |
08:13:30 | FromDiscord | <xzntrc> also i plan to keep this shell minimal |
08:13:48 | FromDiscord | <xzntrc> simply one file for now |
08:13:52 | FromDiscord | <xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005750611343593523/unknown.png |
08:13:57 | FromDiscord | <Rika> You can try it but I don’t think it would be practical in daily use |
08:14:04 | FromDiscord | <xzntrc> how so? |
08:14:09 | FromDiscord | <xzntrc> If I spend enough time on it |
08:14:14 | FromDiscord | <xzntrc> then it may |
08:14:34 | FromDiscord | <Rika> Enough time being a lot of time |
08:15:59 | FromDiscord | <enthus1ast> "linux shells" "enjoy" \:D |
08:16:15 | FromDiscord | <Elegantbeef> Fish is fucking lovely! |
08:16:35 | FromDiscord | <enthus1ast> it cant, since its a linux shell, operating on string soups |
08:16:35 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1005751297754026025/image.png |
08:16:39 | FromDiscord | <Elegantbeef> Look at that autocomplete |
08:17:46 | FromDiscord | <Elegantbeef> It's ok to be wrong i wont hold it against you |
08:17:50 | FromDiscord | <Rika> It’s not too bad in fish because they also have arrays |
08:18:17 | FromDiscord | <Elegantbeef> Fish is quite a good shell though not mainstream and lacks bash support |
08:18:46 | FromDiscord | <Rika> The reason it’s good is because it lacks bash support xddddd |
08:18:56 | FromDiscord | <Elegantbeef> https://fishshell.com/assets/img/screenshots/scripting.png like it's a readable language |
08:19:14 | FromDiscord | <Elegantbeef> Pretty much rika, no backwards compatibility so it can be sensible |
08:19:33 | FromDiscord | <enthus1ast> i always feel awkward, setting up systems, splitting and cutting and awking, and grepping in linux/unix shells, ↵the powershell approach is faaar superior (i do not like powershell either btw...) |
08:19:52 | FromDiscord | <Elegantbeef> Ok |
08:20:09 | FromDiscord | <enthus1ast> since they have real datatypes, like tables |
08:20:19 | FromDiscord | <enthus1ast> and commands actually output tables |
08:20:24 | FromDiscord | <enthus1ast> not text |
08:20:59 | FromDiscord | <enthus1ast> so you can say\: give me this row column, and thats an int |
08:21:15 | FromDiscord | <Elegantbeef> I've persoanlly never needed that so... ok |
08:21:47 | FromDiscord | <Rika> Well again fish has arrays so |
08:21:58 | FromDiscord | <Rika> At least the table part is mitigated |
08:22:22 | FromDiscord | <Rika> I think the benefit of powershell dissolves once you use regular executables as commands |
08:22:25 | FromDiscord | <enthus1ast> yeah, but the commands the GNU/Linux uses, just outputs text↵(@Rika) |
08:23:47 | FromDiscord | <Rika> In reply to @enthus1ast "yeah, but the commands": You mean the same other commands windows uses as well? |
08:23:56 | FromDiscord | <Rika> Built ins in fish use the array system |
08:25:00 | FromDiscord | <Elegantbeef> Yea i dont have much usage of shells aside from using it as a CLI to say anything |
08:25:18 | FromDiscord | <Elegantbeef> Fish makes me happier to use my terminal which makes me feel obligated to say it's better than anything windows has |
08:25:47 | FromDiscord | <Elegantbeef> If you're writing programs in shell languages i feel you've strayed from the light |
08:26:10 | FromDiscord | <Rika> If you’re programming anything at all you’ve already strayed from the light |
08:28:34 | FromDiscord | <enthus1ast> https://gist.github.com/enthus1ast/1cc83ca38c5d5b79cfaa88990711d03c |
08:30:08 | FromDiscord | <enthus1ast> yeah, i understand, no bashing on my side; this is only stuff i notice when writing shell scripts on different os'es. |
08:31:55 | FromDiscord | <enthus1ast> i'm not fluent in both, linux or windows scritping, but just do the stuff i need in nim or python |
08:32:25 | FromDiscord | <xzntrc> still nothing wrong with making a shell right? |
08:32:53 | FromDiscord | <enthus1ast> naah |
08:33:01 | FromDiscord | <enthus1ast> cool project |
08:35:14 | FromDiscord | <xzntrc> so can I make my own .nims files? |
08:35:39 | FromDiscord | <xzntrc> https://nim-lang.org/docs/nims.html doesn't help |
08:37:02 | FromDiscord | <xzntrc> oh wait nvm: https://nim-lang.org/docs/parsecfg.html |
09:11:57 | * | kenran joined #nim |
09:13:26 | * | kenran quit (Client Quit) |
09:23:23 | FromDiscord | <Phil> Meanwhile, I'm just sitting here, actually really enjoying crapping together 5-10 line scripts to combine 5 commands into 1 |
09:23:45 | FromDiscord | <Phil> (edit) "Meanwhile, I'm just sitting here, actually really enjoying ... crapping" added "bash and" |
09:28:20 | FromDiscord | <!&luke> This server is so active compared to the servers for some other languages |
09:28:46 | FromDiscord | <Phil> is it? |
09:29:20 | FromDiscord | <!&luke> Yea |
09:29:35 | FromDiscord | <Phil> I only have Rust as a comparison 10 months ago, that was almost spammy active but the ratio of askers to helpers was like 5:1 |
09:29:35 | FromDiscord | <!&luke> 30second response |
09:29:55 | FromDiscord | <Phil> Fair point |
09:30:36 | FromDiscord | <!&luke> Elixir is still quite active I would say 2 minutes on a good day but usually less than 5 minutes |
09:30:43 | FromDiscord | <!&luke> Zig is also quite active |
09:30:59 | FromDiscord | <!&luke> Dart is dead |
09:32:05 | FromDiscord | <!&luke> Like dead enough that I haven't gotten a response in 2 days |
09:32:09 | FromDiscord | <!&luke> https://media.discordapp.net/attachments/371759389889003532/1005770307006627861/IMG_1877.png |
09:33:34 | FromDiscord | <xzntrc> In reply to @ripluke "This server is so": bro im in the Jetbrains community, and the last message sent was from me |
09:33:36 | FromDiscord | <xzntrc> ... yesterday |
09:34:07 | FromDiscord | <xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005770804635643964/unknown.png |
09:34:14 | FromDiscord | <xzntrc> mind you there are 800 FUCKING MEMBERS ONLINE RN |
09:34:18 | FromDiscord | <Phil> bwahahaha |
09:34:40 | FromDiscord | <Phil> Actually, before we derail the channel to much, that kind of convo I think makes sense to have in offtopic to keep the language specific questions in here |
09:34:50 | FromDiscord | <xzntrc> right soz |
09:35:04 | FromDiscord | <Phil> No worries, I'm not great in that regard either ^^ |
09:36:09 | FromDiscord | <Phil> Rika yesterday told me about the high level stuff around async await, I'm still wondering on the low-level side is a callback of sorts that one could manipulate.↵I don't have any practical ideas around that, I'm just wondering |
09:36:16 | * | pro joined #nim |
09:37:00 | FromDiscord | <Phil> (edit) "Rika yesterday told me about the high level stuff around async await, I'm still wondering ... onit" added "whether" | "is" => "it just waits for" | "of sorts" => "to evaluate to tree before it continues the code and whether you can access" | "one could manipulate.↵I" => "callback, maybe even manipulate it.↵I" |
09:37:14 | FromDiscord | <Phil> (edit) "tree" => "true" |
09:37:22 | FromDiscord | <Phil> God damnit I can not type for shit this day |
09:37:34 | FromDiscord | <xzntrc> lol |
09:37:43 | FromDiscord | <xzntrc> how is `existsOrCreateDir` supposed to be used? |
09:37:49 | FromDiscord | <xzntrc> I cant understand the docs lol |
09:38:04 | FromDiscord | <Phil> You mean what it does? |
09:38:48 | FromDiscord | <Phil> I assume the string to throw in is a valid file path, depending on the situation a relative or absolute one |
09:39:00 | FromDiscord | <xzntrc> how would you use it in code? |
09:39:09 | FromDiscord | <xzntrc> im slightly confused on understanding these docs |
09:39:17 | FromDiscord | <!&luke> In reply to @xzntrc "how is `existsOrCreateDir` supposed": If the doesn't exist create it |
09:39:38 | FromDiscord | <xzntrc> so what I just use:↵`existsOrCreateDir(path)`↵? |
09:39:40 | FromDiscord | <xzntrc> that simple? |
09:39:44 | FromDiscord | <!&luke> Yea |
09:40:00 | FromDiscord | <Phil> `existsOrCreateDir("/home/user/phil/dev/nimstoryfont/newDirIWantToCreate")` |
09:40:00 | FromDiscord | <!&luke> Path would be a string |
09:40:19 | FromDiscord | <xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46Tz |
09:40:33 | FromDiscord | <!&luke> put discard in front of it |
09:40:41 | FromDiscord | <Phil> Ah, check,do you care whether it actually created the dir or did not do so since it already existed? |
09:40:46 | FromDiscord | <Phil> If no, just put "discard" in front of it |
09:40:53 | FromDiscord | <!&luke> discard existsOrCreareDir(patg) |
09:40:58 | FromDiscord | <!&luke> (edit) "existsOrCreareDir(patg)" => "existsOrCreareDir(path)" |
09:41:08 | FromDiscord | <!&luke> (edit) "existsOrCreareDir(path)" => "existsOrCreateDir(path)" |
09:41:13 | FromDiscord | <xzntrc> ohhh right sorry! |
09:41:21 | FromDiscord | <!&luke> Why not just use createDir tho |
09:41:28 | FromDiscord | <Phil> Unlike python, nim does not like you using procs that return something and then not doing anything with the return.↵It wants to enforce that you intentionally do not do something with the return instead of risking that you forgot about it |
09:41:38 | FromDiscord | <!&luke> In reply to @ripluke "Why not just use": If you don't care about the dir existing |
09:41:45 | FromDiscord | <xzntrc> In reply to @ripluke "If you don't care": i do care. |
09:41:51 | FromDiscord | <xzntrc> I dont want it to overwrite shit inside it |
09:42:06 | FromDiscord | <!&luke> I don't think createDir does that |
09:42:13 | FromDiscord | <Rika> In reply to @Isofruit "Rika yesterday told me": The future is registered to the dispatcher and it is checked every few times by the main event loop (that’s what the loop in run forever does) |
09:42:46 | FromDiscord | <Rika> Once the future completes it is removed from the registration, which is why run forever raises an exception when all your futures complete |
09:43:01 | FromDiscord | <Rika> At least that’s how I know it |
09:43:21 | FromDiscord | <Rika> You can get even lower level than this but it goes into the details of how the polling is done in the OS |
09:43:49 | FromDiscord | <!&luke> What is the difference between async and a coroutine |
09:43:58 | FromDiscord | <Rika> Asynchronous functions are just closure iterators for the “stop here then start here again when needed” |
09:44:01 | FromDiscord | <Rika> Functionality |
09:44:15 | FromDiscord | <Rika> Functionally none I believe |
09:44:26 | FromDiscord | <Rika> More work with the coroutine |
09:44:36 | FromDiscord | <!&luke> Oh |
09:45:14 | FromDiscord | <Phil> In reply to @xzntrc "I dont want it": Just checked in my playground project:↵If you "create a dir that already exists" the operation does essentially nothing |
09:45:26 | FromDiscord | <Phil> It doesn't even change access permission or owners of the folder |
09:45:30 | FromDiscord | <!&luke> In reply to @Isofruit "Just checked in my": Yea I always just use createDir |
09:45:33 | FromDiscord | <Rika> Async can be a wrapper for coroutines |
09:45:40 | FromDiscord | <Rika> Coroutines have more uses than async |
09:45:49 | FromDiscord | <!&luke> In reply to @ripluke "Yea I always just": Saves a check of dirExists |
09:45:51 | FromDiscord | <Rika> Async can be implemented with a different method than coroutines |
09:46:02 | FromDiscord | <xzntrc> In reply to @Isofruit "Just checked in my": cool, I ended up using it as a bool and getting the value anyways |
09:46:19 | FromDiscord | <!&luke> In reply to @Rika "Async can be implemented": Oh |
09:46:35 | FromDiscord | <!&luke> In reply to @xzntrc "cool, I ended up": Do you use the value for anything? |
09:46:42 | FromDiscord | <xzntrc> In reply to @ripluke "Do you use the": yep. |
09:46:57 | FromDiscord | <!&luke> Oh ok |
09:47:08 | FromDiscord | <Phil> In reply to @Rika "You can get even": Hmmm and once the future completes that triggers an event that informs the await that it is done and the code can continue?↵So it's not like it's calling an evaluating a specific callback over and over again, hmm |
09:47:16 | FromDiscord | <xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46TD |
09:48:30 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46TF |
09:48:30 | FromDiscord | <xzntrc> In reply to @ripluke "Why not just use": 😭 |
09:48:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=46TG |
09:48:51 | FromDiscord | <xzntrc> sure i'm open to taking feedback |
09:49:06 | FromDiscord | <!&luke> In reply to @xzntrc "😭": Saves you and if chech |
09:49:08 | FromDiscord | <xzntrc> dumping everything on my git: https://git.kiwifarms.net/xzntrc/xshellNim |
09:49:09 | FromDiscord | <!&luke> (edit) "chech" => "check" |
09:49:13 | FromDiscord | <Phil> I know more about logging after having to deal with log4j-buggs than I ever wanted to know |
09:49:33 | FromDiscord | <!&luke> (edit) "and" => "an" |
09:49:47 | FromDiscord | <!&luke> (edit) "an if" => "a" |
09:50:18 | FromDiscord | <Phil> At least I'm not the only one today that needs to make use of the edit button way too often |
09:51:03 | FromDiscord | <!&luke> What edit button |
09:56:55 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=46TK |
09:57:20 | FromDiscord | <aph> (edit) "https://play.nim-lang.org/#ix=46TK" => "https://play.nim-lang.org/#ix=46TL" |
09:57:57 | FromDiscord | <Phil> Futhark is out of my wheelhouse, is Pmunch around or beef still around? |
09:59:27 | FromDiscord | <aph> ah, ima ask another time when they're here, thx |
10:00:07 | FromDiscord | <Phil> Apologies... I really should start actually wrapping something in futhark, solely in order to shake off my fear of C and wrapping its code |
10:00:45 | FromDiscord | <Phil> Though just thinking about how apparently for an array you just pass a pointer to the first element makes me angry |
10:00:45 | FromDiscord | <Rika> Many people fear the C |
10:01:09 | FromDiscord | <aph> In reply to @aph "hiii, i got this": oh wait, i can just add a header file, i think it's just header file hell, once i added unistd.h i'm missing getopt |
10:01:14 | FromDiscord | <aph> :) |
10:01:25 | FromDiscord | <!&luke> I hate c code, everything is snake_cased |
10:01:35 | FromDiscord | <!&luke> It's just unreadable to me |
10:02:37 | FromDiscord | <aph> In reply to @Isofruit "Apologies... I really should": lol, me2 |
10:05:42 | FromDiscord | <Phil> In reply to @Rika "Many people fear the": The very valid fear to drown in it! |
10:08:33 | * | xcodz-dot joined #nim |
10:08:41 | xcodz-dot | ping |
10:09:00 | xcodz-dot | anyone? |
10:11:41 | * | neceve joined #nim |
10:12:03 | FromDiscord | <Phil> pong |
10:12:29 | xcodz-dot | Hey Phil, are you on the nim compiler team? |
10:12:49 | FromDiscord | <Phil> I am way too incompetent for that↵I have understood my first macro around a week ago 😄 |
10:13:23 | FromDiscord | <Phil> If you want webdev advice I can design you an entire tech stack and architecture advice on prologue though ^^ |
10:13:48 | xcodz-dot | well, unfortunately I am a backend guy :) |
10:13:51 | FromDiscord | <Phil> And general advice for language capabilities and more in-depth playing around with generics |
10:14:05 | FromDiscord | <Phil> Prologue is a backend-server xP |
10:14:45 | xcodz-dot | oh, i thought prologue was some sort of english word as you can prolly tell, English isnt my native language. |
10:14:46 | FromDiscord | <Phil> I got exposed to a fair amount of what nim can do in the webdev space by writing my backend in it, frontend is angular though |
10:15:13 | xcodz-dot | you can try frontend with nim, it supports js backend |
10:16:10 | FromDiscord | <Phil> sent a long message, see http://ix.io/46TQ |
10:17:03 | FromDiscord | <Phil> And yeah you can do frontend in nim, but in the end it's all JS anyway and it's not like JS is an incredibly hard language to write.↵Particularly with all the tooling it has I'm pretty comfortable with a separate frontend |
10:17:14 | FromDiscord | <Rika> Prologue is indeed an English word |
10:17:20 | FromDiscord | <Rika> It coincides with the Nim library |
10:17:30 | xcodz-dot | hmm |
10:18:03 | xcodz-dot | Does matrix also support anonymous login like IRC does? |
10:18:10 | xcodz-dot | this IRC tech is really ancient |
10:18:21 | FromDiscord | <xzntrc> IRC itself is ancient |
10:18:38 | FromDiscord | <xzntrc> i personally prefer xmpp |
10:21:48 | xcodz-dot | anyone knows how am I suppose to generate docs for my nimble project |
10:21:54 | xcodz-dot | ? |
10:23:56 | FromDiscord | <Rika> No matrix requires a home server and an account I believe |
10:24:04 | * | PMunch joined #nim |
10:25:21 | xcodz-dot | btw, nimble doc requires filename, How am I suppose to gen docs then for multimod project? |
10:26:35 | FromDiscord | <amadan> If you have a main module that imports the other modules then adding `--project` flag will generate docs for the other modules |
10:27:37 | xcodz-dot | thanks, I do infact have a main module. |
10:51:36 | FromDiscord | <exelotl> xmpp seems really underrated tbh |
10:51:53 | FromDiscord | <exelotl> I set it up recently but don't have any contacts lol |
11:02:37 | * | arkurious joined #nim |
11:16:12 | * | xcodz-dot quit (Quit: Leaving) |
11:32:01 | FromDiscord | <!&luke> Can futhark use pkg-config |
11:40:07 | FromDiscord | <Rika> Use what? |
11:41:40 | FromDiscord | <!&luke> Package config |
11:41:49 | FromDiscord | <!&luke> To dynamically link |
11:42:00 | FromDiscord | <!&luke> (edit) "Package config" => "pkg-config" |
11:42:08 | FromDiscord | <!&luke> In reply to @ripluke "pkg-config": It's a Linux thing |
11:42:22 | FromDiscord | <!&luke> In reply to @ripluke "To dynamically link": It finds your c libraries |
11:42:32 | FromDiscord | <!&luke> And gives you their paths |
11:43:59 | FromDiscord | <!&luke> Maybe using --passL |
11:46:55 | FromDiscord | <hotdog> @!&luke You could call out to `pkg-config` and use the output |
11:47:09 | FromDiscord | <hotdog> Should be pretty straightforward |
12:18:10 | FromDiscord | <!&luke> I can't get it with passL as I have to set the path in the file itself |
12:27:16 | FromDiscord | <!&luke> Pmunch or beef can you help me |
12:30:17 | * | pro quit (Quit: pro) |
12:31:19 | PMunch | You can use pkg-config |
12:32:42 | FromDiscord | <!&luke> In reply to @PMunch "You can use pkg-config": Yes but how lol because I have to specify the path in the file and not from the command line while compiling |
12:34:26 | PMunch | What's the output of pkg-config? |
12:37:36 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46Uz |
12:38:15 | PMunch | Okay, that all looks fine |
12:38:31 | PMunch | The path you pass to Futhark just needs to contain the header files you want to import |
12:39:23 | FromDiscord | <!&luke> what |
12:39:26 | * | jmd_ quit (Ping timeout: 240 seconds) |
12:40:03 | FromDiscord | <!&luke> i want to use package config so that i can dynamically link |
12:40:26 | PMunch | Yeah, that's what I do as well |
12:40:36 | PMunch | But you still need to import headers |
12:41:12 | PMunch | So you need the -I statements, not the -L |
12:41:20 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46UE |
12:41:49 | PMunch | What is that define for? |
12:42:02 | PMunch | Where is the vips path? |
12:43:22 | FromDiscord | <!&luke> Like in a c file I would use ↵#include <vips/vips.h> |
12:43:42 | FromDiscord | <!&luke> That's why I put vips as the path |
12:44:12 | FromDiscord | <!&luke> I don't have a vips dir I thought that pkg-config would be able to find it |
12:44:29 | FromDiscord | <!&luke> (edit) "I don't have a vips dir ... I" added "(in that directory)" |
12:44:30 | PMunch | So path needs to be "/usr/include/vips" and then import "vips.h" |
12:44:41 | FromDiscord | <!&luke> Oh |
12:46:17 | PMunch | You could of course parse the output of `pkg-config --cflags-only-I` in a macro and pass that to futhark |
12:50:32 | FromDiscord | <!&luke> I am not able to run any of the functions from the library lol |
12:57:24 | FromDiscord | <!&luke> PMunch: I can't use any of the functions... |
12:57:49 | FromDiscord | <!&luke> It says undeclared identifier |
12:57:49 | PMunch | Then you've done something wrong |
12:58:27 | FromDiscord | <!&luke> Do I passL? |
12:58:33 | PMunch | Yes |
12:58:56 | FromDiscord | <!&luke> And do I pass the file or the directory that the file is |
12:59:05 | PMunch | You do --passsL:"`pkg-config command`" |
12:59:12 | FromDiscord | <!&luke> Oh |
12:59:58 | PMunch | You pass the folder where each file you need to import is with `path` and then the files you'd normally import in C with just a normal string at the end |
13:00:35 | FromDiscord | <!&luke> What |
13:04:31 | PMunch | Just do what I explained earlier |
13:10:09 | FromDiscord | <!&luke> In reply to @PMunch "Just do what I": Doing that I get the error invalid command line option -I |
13:10:44 | PMunch | Did you pass --libs or whatever it is to pkg-config? |
13:11:27 | FromDiscord | <!&luke> In reply to @PMunch "You could of course": I used this command |
13:11:29 | PMunch | It looks like you messed up your passL thing |
13:12:06 | FromDiscord | <!&luke> nimble build --passL:"$(pkg-config --cflags-only-I vips)" |
13:12:14 | FromDiscord | <!&luke> The command I used |
13:12:26 | PMunch | Yeah, you can't pass I flags to passL |
13:12:38 | PMunch | You need to use pkg-config --libs I believe |
13:12:45 | FromDiscord | <!&luke> oh |
13:13:28 | FromDiscord | <!&luke> nope |
13:13:44 | PMunch | The cflags-only-I was in case you wanted to parse the output of that command in a macro and pass it to Futhark instead of using `path` |
13:13:44 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46UR |
13:14:02 | FromDiscord | <!&luke> the command: nimble build --passL:"$(pkg-config --libs vips)" |
13:14:43 | PMunch | It doesn't appear to properly encapsulate the output of pkg-config in passL |
13:15:06 | FromDiscord | <!&luke> hmm? |
13:15:30 | FromDiscord | <!&luke> it does get the output |
13:15:37 | FromDiscord | <!&luke> the error shows that |
13:15:45 | PMunch | Yes put it doesn't properly put it in quotes |
13:16:00 | PMunch | So not everything is passed along to passL, some of it is parsed as commands to Nim, which fails |
13:17:07 | FromDiscord | <!&luke> ok yea the passL worked in double quotes |
13:17:19 | FromDiscord | <!&luke> but now none of the functions work |
13:17:52 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46US |
13:27:19 | PMunch | And the error? |
13:27:56 | PMunch | Ah VIPS_INIT is a macro, not a function |
13:28:07 | PMunch | Function macros aren't well supported |
13:28:35 | PMunch | Try to call vips_init instead |
13:28:40 | FromDiscord | <!&luke> ok |
13:30:57 | FromDiscord | <!&luke> Nope that doesn't work |
13:31:11 | FromDiscord | <!&luke> Neither do any of the other functions in the library |
13:33:31 | PMunch | And /usr/include/vips exists? |
13:33:38 | FromDiscord | <!&luke> Yup |
13:33:51 | PMunch | And it has vips.h in it? |
13:33:59 | FromDiscord | <!&luke> Yup |
13:34:08 | PMunch | Hmm, try to delete your Nim cache |
13:34:20 | FromDiscord | <!&luke> vips says this https://www.libvips.org/API/current/binding.html |
13:35:13 | PMunch | Well, I'm off to make dinner now |
13:35:22 | PMunch | So I won't be able to help more right now |
13:35:53 | FromDiscord | <!&luke> Ok |
13:47:47 | FromDiscord | <voidwalker> any way to get an xml file from a XmlNode object I obtained with parseHtml ? I've no idea what I'm doing/looking for, to get the data I need |
13:48:30 | FromDiscord | <voidwalker> ` <td class="result_text"> <a href="/title/tt0133093/?ref_=fn_tt_tt_1">Matrix</a> (1999) </td>` |
13:50:43 | FromDiscord | <voidwalker> Oh I got it. It's html.findAll("td"), td.innerText |
13:51:00 | Amun-Ra | if the data structure does not change, perhaps try regexp, it's better than parsing xml with html parser |
13:51:20 | Amun-Ra | well, nvm |
13:51:36 | Amun-Ra | please disregard what I wrote above |
14:30:10 | FromDiscord | <Forest> How do i use a library after compiling with futhark? |
14:54:54 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Vr |
14:55:23 | FromDiscord | <voidwalker> would this code be normally be able to cause `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` ? |
14:58:23 | FromDiscord | <Phil> is result a ref type? |
14:58:24 | FromDiscord | <voidwalker> seems to crash at /usr/lib/nim/pure/strtabs.nim(207) hasKey |
14:59:06 | FromDiscord | <voidwalker> happens without that line, if i put discard |
14:59:21 | FromDiscord | <voidwalker> /home/sgm/igma/imdb.nim(274) myGetIMDBTitleSearch↵/usr/lib/nim/pure/strtabs.nim(207) hasKey↵/usr/lib/nim/pure/strtabs.nim(133) rawGet↵/usr/lib/nim/pure/strtabs.nim myhash |
14:59:39 | FromDiscord | <voidwalker> (edit) "/home/sgm/igma/imdb.nim(274) myGetIMDBTitleSearch↵/usr/lib/nim/pure/strtabs.nim(207) hasKey↵/usr/lib/nim/pure/strtabs.nim(133) rawGet↵/usr/lib/nim/pure/strtabs.nim myhash" => "sent a code paste, see https://play.nim-lang.org/#ix=46Vt" |
15:01:15 | * | oprypin quit (Quit: Bye) |
15:01:32 | * | oprypin joined #nim |
15:03:12 | FromDiscord | <Phil> a is of type XmlNode, which is a ref-type.↵I assume that some of your a's are nil? Did you check for that? |
15:03:52 | FromDiscord | <voidwalker> hm nope, I thought they can't be nil if they are found |
15:04:00 | FromDiscord | <voidwalker> what is a nil XmlNode anyway |
15:04:40 | FromDiscord | <Phil> No clue where it would come from. I can only say what I'm seeing, which is that somewhere you likely have a ref-type that you're accessing but that has no memory allocated for it |
15:06:05 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46VC |
15:06:10 | FromDiscord | <voidwalker> same crash |
15:09:09 | FromDiscord | <Phil> Ohhh XMLAttributes which you nab via attrs is also a ref type |
15:09:11 | FromDiscord | <Phil> Check if that is nil? |
15:09:36 | FromDiscord | <Phil> Might be nil if your a just doesn't have any attributes I'd assume |
15:10:49 | FromDiscord | <Rika> why is xmlattr also a ref type i wonder |
15:11:40 | FromDiscord | <Phil> Maybe it can get really large and thus it's better to avoid copies? Guessing on my end really |
15:12:50 | FromDiscord | <Rika> i doubt |
15:13:15 | FromDiscord | <Rika> its very unlikely for attrs to become large, i dont know many instances where xml attributes exceed a hundred |
15:14:08 | FromDiscord | <voidwalker> That was it Phil, the last a had no attributes, and was nil.. |
15:14:14 | FromDiscord | <voidwalker> (edit) "a" => "`a`" |
15:15:03 | FromDiscord | <Phil> In reply to @voidwalker "That was it Phil,": In that case instead of nil-checking I'd recommend writing your own "hasKey" proc once that includes the nil-check |
15:15:49 | FromDiscord | <Phil> So you do that only once in a single proc somewhere instead of all the time everywhere |
15:15:58 | FromDiscord | <voidwalker> yeah that's how it should be done.. but, too much code |
15:16:10 | FromDiscord | <Phil> Isn't it like 4 lines? |
15:17:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=46VD |
15:17:56 | FromDiscord | <Phil> Actually, I bet that could be a oneliner |
15:18:39 | FromDiscord | <Phil> `proc hasAttribute(node: XmlNode, key: string): bool = if a.attrs == nil: false else: a.attrs.hasKey(key)` |
15:20:06 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=46VF |
15:20:15 | FromDiscord | <Phil> I keep forgetting isNil is a thing |
15:20:47 | FromDiscord | <Phil> Good addition Patito! |
15:21:13 | FromDiscord | <Phil> Although I would throw in that you're really relying on that implicit return of false |
15:21:52 | FromDiscord | <Phil> So personally I'd stick with the if-else |
15:25:34 | FromDiscord | <lantos> can someone please help me reset my nim forum account? |
15:26:03 | FromDiscord | <Phil> Have you asked moderator? |
15:26:38 | FromDiscord | <Phil> As in, pinged them, might give you the fastest reaction ^^ |
15:27:06 | FromDiscord | <Tuatarian> what's the difference bewteen isNil and `== nil`? |
15:27:08 | FromDiscord | <lantos> Is there a list of mods for the forum I tried looking for it |
15:27:19 | FromDiscord | <Tuatarian> just ping araq/dom/mratsim/pmunch |
15:27:36 | FromDiscord | <Tuatarian> maybe not araq |
15:27:36 | FromDiscord | <Phil> In reply to @lantos "Is there a list": Ah, you can just ping with <@&371760044473319454> |
15:27:41 | FromDiscord | <lantos> ah 🙂 |
15:27:43 | FromDiscord | <lantos> thanks phil |
15:27:51 | FromDiscord | <Phil> (edit) "In reply to @lantos "Is there a list": Ah, you can just ping with <@&371760044473319454> ... " added "(For context: lantos wants to reset nim account)" |
15:27:54 | FromDiscord | <Tuatarian> does that work for pinging anyone other than dom? |
15:27:56 | FromDiscord | <Phil> To state your nim account name though |
15:27:59 | FromDiscord | <Phil> (edit) "To" => "Do" |
15:28:02 | FromDiscord | <Tuatarian> since dom is the only one that uses discord |
15:28:04 | FromDiscord | <Phil> So that they know what to do |
15:28:09 | FromDiscord | <Rika> In reply to @iWonderAboutTuatara "what's the difference bewteen": its more often that == is overloaded |
15:28:31 | FromDiscord | <Phil> In reply to @iWonderAboutTuatara "what's the difference bewteen": isNil is more expressive as in it reads more like proper english |
15:28:43 | FromDiscord | <!Patitotective> In reply to @Isofruit "Although I would throw": well, i dont see a problem on relying on it since it will always be false, its a convention i think |
15:28:53 | FromDiscord | <Rika> ~~kinda like the == vs .equals debacle on java ig...~~ |
15:28:57 | FromDiscord | <lantos> <@&371760044473319454> Hey could you please help me gain access back on my nim forum account my acc is Lantos |
15:29:07 | FromDiscord | <Rika> double ping moment |
15:29:07 | FromDiscord | <Tuatarian> @Rika does it not use the `==` operator in it's defn? |
15:29:13 | FromDiscord | <Tuatarian> lmao |
15:29:17 | FromDiscord | <Tuatarian> don't delete it tho lantos |
15:29:24 | FromDiscord | <Tuatarian> it leaves an incredibly annoying ghost ping |
15:29:37 | FromDiscord | <Phil> In reply to @Patitotective "well, i dont see": That's perfectly valid and completely correct! ↵I just prefer things to be explicitly stated and not rely on implicit "invisible" behaviour such as default-instantiation. |
15:29:44 | FromDiscord | <Phil> (edit) "default-instantiation." => "default-instantiation values." |
15:30:17 | FromDiscord | <lantos> In reply to @iWonderAboutTuatara "don't delete it tho": huh? |
15:30:31 | FromDiscord | <Phil> In reply to @Rika "~~kinda like the ==": We had that debate in JS at work recently, it was hilarious to me |
15:31:07 | FromDiscord | <Phil> Because in JS we INSIST on never ever using "==" or "!=", it MUST be "===" or "!==", which becomes a massive pain when you want to check for a value existing because that's either null or undefined |
15:31:10 | FromDiscord | <Tuatarian> you pinged mods one time more than needed (not a huge deal) but I was saying not to delete the message with the ping since it leaves a ghost ping on their accs |
15:31:19 | FromDiscord | <!Patitotective> In reply to @Isofruit "That's perfectly valid and": i agree its clearer but i actually prefer short intuitive stuff hehe |
15:31:38 | FromDiscord | <flywind> IRRC there are some bugs where isNil works but not `==`. |
15:32:06 | FromDiscord | <Phil> What ended up happening when I pointed out that writing "bla !== null && bla !== undefined" is a massive pain was, that lodash contains an `isNull` function |
15:32:25 | FromDiscord | <leorize> isNil might work better in VM due to how it's implemented |
15:32:26 | FromDiscord | <Phil> So we should do that instead of the completely inacceptable "bla == null" to check whether something is null or undefined |
15:33:35 | FromDiscord | <flywind> Yeah I had a PR intending to remove `isNil` but rejected => https://github.com/nim-lang/Nim/pull/16191 |
15:33:45 | FromDiscord | <Tuatarian> only tangentially related but I feel like backticks should make a function name a binary identifier |
15:33:55 | FromDiscord | <Tuatarian> so that you can define custom operators with word names |
15:34:31 | FromDiscord | <Tuatarian> like `sgnmod` for signed modulus or things like that |
15:34:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=46VM |
15:35:05 | FromDiscord | <Tuatarian> lmao |
15:35:07 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=46VM" => "https://play.nim-lang.org/#ix=46VN" |
15:35:46 | FromDiscord | <Phil> so now I'm using isNil in JS at work instead of the evil `==` |
15:36:09 | FromDiscord | <Phil> Which I agree should be banned in general, but for this particular instance I find it somewhat ridiculou |
15:36:10 | FromDiscord | <Phil> (edit) "ridiculou" => "ridiculous" |
15:41:08 | Amun-Ra | so you're using evil JS… ;> |
15:41:41 | * | Amun-Ra is using == and != comparisons when checking nil |
15:42:47 | FromDiscord | <Phil> In reply to @Amun-Ra "so you're using evil": I think we can agree that all JS is evil to a degree, some just less so than other |
15:43:06 | FromDiscord | <Phil> In reply to @Amun-Ra "is using == and": Could you rephrase? I don't think I get that sentence |
15:43:37 | Amun-Ra | I mean I prefer ==/!= to isNil |
15:44:04 | Amun-Ra | but that's just /me |
15:44:12 | FromDiscord | <Phil> in nim? or in js? |
15:44:35 | Amun-Ra | nim |
15:44:54 | Amun-Ra | js doesn't have one iirc |
15:45:05 | FromDiscord | <Phil> lodash, an often used JS lib, does, thus my question ^^ |
15:45:32 | Amun-Ra | and I usually do not read backlogs completely ;> |
15:49:42 | FromDiscord | <Phil> fair |
15:51:53 | FromDiscord | <PMunch> In reply to @lantos "<@&371760044473319454> Hey could you": Gain access back? |
15:52:25 | FromDiscord | <lantos> Yeah I originally signed up with an email I no longer have access to |
15:52:46 | FromDiscord | <lantos> (edit) "to" => "to, I had some random password so can't get back in" |
15:53:12 | FromDiscord | <lantos> Are you able to reset the password or email? |
16:01:40 | PMunch | Sure, I can reset both |
16:02:43 | PMunch | Hmm, I can't find the account Lantos |
16:02:55 | PMunch | I think maybe @dom96 has to help with this one |
16:03:22 | FromDiscord | <lantos> https://forum.nim-lang.org/profile/Lantos |
16:08:23 | * | rockcavera joined #nim |
16:08:23 | * | rockcavera quit (Changing host) |
16:08:23 | * | rockcavera joined #nim |
16:21:56 | PMunch | Hmm, my browser for some reason lowercased the URL.. |
16:22:35 | PMunch | @lantos, so what was your previous email, and what is the new one? |
16:22:43 | PMunch | Feel free to PM me that info |
16:34:02 | FromDiscord | <voidwalker> so if I want to combine into a seq[tuple[name: string, id: string]] some text from xmlnodes in a html, that satisfy some conditions... what would be the best approach ? Iterate through each at a time and add to seq.name, seq.id ? or make a custom iterator that yields exactly what I need an iterate through both at once with zip () ? |
16:41:42 | * | PMunch quit (Quit: leaving) |
16:47:19 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46VZ |
16:50:13 | * | ggsx joined #nim |
16:50:40 | FromDiscord | <Rika> thats terrifying |
16:51:45 | FromDiscord | <Phil> I... what am I even reading |
16:52:38 | FromDiscord | <Phil> so you have `seq[XmlNode]` and want to convert to `seq[tuple[name: string, id: string]]`? |
16:52:43 | FromDiscord | <dom96> In reply to @PMunch "Hmm, my browser for": lol, why is nimforum's accounts case sensitive |
16:52:55 | FromDiscord | <dom96> kinda ironic |
16:53:35 | FromDiscord | <voidwalker> nimforum accounts should be first char sensitive only and camelCase |
16:53:59 | FromDiscord | <Phil> and underscores are ignored |
16:54:56 | * | jmdaemon joined #nim |
16:56:45 | FromDiscord | <voidwalker> @Phil actually I realised that all the info I need comes in the "td " html element. It's `<td class="result_text"> <a href="/title/tt0106062/?ref_=fn_tt_tt_2">Matrix</a> (1993) (TV Series) </td>` |
16:57:13 | FromDiscord | <voidwalker> this.innerText has Matrix (1993) (TV Series) |
16:58:00 | FromDiscord | <voidwalker> can I get the `"/title/tt...` from it somehow ? I was doing findAll("a") before to get that |
16:59:31 | FromDiscord | <dom96> In reply to @voidwalker "so if I want": adding to a seq or an iterator are both the simplest, also if you create an iterator then you can also turn it into a seq easily with `sequtils.toSeq` |
17:00:53 | FromDiscord | <Tuatarian> is there an easy way to do operations with uint8 and int? |
17:01:16 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=46W6 |
17:02:04 | FromDiscord | <Rika> do you mean `assert compiles T(y)` instead> |
17:02:20 | FromDiscord | <Tuatarian> they're the same thing right? |
17:02:35 | FromDiscord | <Tuatarian> but yeah that's what I was going for, didn't know `compiles` was a thing |
17:02:41 | FromDiscord | <voidwalker> Woah, figure it out. It's `the_td.child("a").attrs["href"]` |
17:03:05 | FromDiscord | <Tuatarian> but it keeps calling itself instead the actual contains function |
17:03:07 | FromDiscord | <Sun「無用」> Is there higher order functions? |
17:03:13 | FromDiscord | <Tuatarian> yes |
17:03:20 | FromDiscord | <Sun「無用」> what's the syntax? |
17:03:24 | FromDiscord | <Tuatarian> look at `sugar` module |
17:03:35 | FromDiscord | <Elegantbeef> it's a pointless check |
17:03:36 | FromDiscord | <Elegantbeef> so if `T(y)` doesnt compile you'll never get the assertion |
17:03:36 | FromDiscord | <Elegantbeef> `assert` is done at runtime |
17:03:38 | FromDiscord | <Rika> In reply to @iWonderAboutTuatara "but it keeps calling": `[T, V: not T]`? |
17:03:51 | FromDiscord | <Rika> i'm not sure what youre trying to do |
17:03:54 | FromDiscord | <Rika> converter? |
17:04:01 | FromDiscord | <Sun「無用」> In reply to @iWonderAboutTuatara "yes": do you the syntax for it? |
17:04:31 | FromDiscord | <Tuatarian> I want to be able to do operations with uint8 and int without typing `.int` or `.uint8` all the time |
17:04:35 | FromDiscord | <Tuatarian> it gets annoying after a bit |
17:04:44 | FromDiscord | <Tuatarian> In reply to @Sun「無用」 "do you the syntax": look at the `sugar` module in stdlib |
17:04:56 | FromDiscord | <Rika> In reply to @iWonderAboutTuatara "I want to be": well why are you converting between the two in the first place |
17:04:57 | FromDiscord | <Tuatarian> it provides easy ways of passing procs to other procs |
17:05:48 | FromDiscord | <Tuatarian> In reply to @Rika "well why are you": I have a type which is two `set[uint8]` but want to be able to do iterations over ranges and such without having to repeatedly type `i.uint8` |
17:06:04 | FromDiscord | <Tuatarian> also, I am not sure I can guarantee that everything I will be iterating over fits into `uint8` |
17:06:04 | FromDiscord | <Elegantbeef> `system.contains(x, T(y))` is what you want |
17:06:18 | FromDiscord | <Tuatarian> that's still a lot of typing though, right? |
17:06:29 | FromDiscord | <Elegantbeef> For your proc |
17:06:44 | FromDiscord | <Tuatarian> oh, I see |
17:06:46 | FromDiscord | <Elegantbeef> Or i guess rika's generic works aswell |
17:06:48 | FromDiscord | <Tuatarian> to make it not call itself |
17:06:49 | FromDiscord | <Rika> well i fixed it without that anyway |
17:07:01 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=46W8 |
17:07:04 | FromDiscord | <Rika> forgot to remove the assert |
17:07:07 | FromDiscord | <Tuatarian> https://play.nim-lang.org/ |
17:07:11 | FromDiscord | <Rika> lol |
17:07:18 | FromDiscord | <Tuatarian> oh oops |
17:07:20 | FromDiscord | <Elegantbeef> The `[T: int]` is cute rika |
17:07:20 | FromDiscord | <Tuatarian> I see my mistake |
17:07:43 | FromDiscord | <Rika> i mean idk |
17:07:48 | FromDiscord | <Elegantbeef> If you ever get a `set[int]` i'm scared at your computer and it's stack size |
17:07:51 | FromDiscord | <Tuatarian> wait nevrmind, I don't |
17:08:18 | FromDiscord | <Rika> also sorry, you have to `[T; V: not T]` |
17:08:40 | FromDiscord | <Tuatarian> what does the semicolon do here? |
17:08:41 | FromDiscord | <Rika> its not gonna compile if it cant convert anyway so |
17:08:57 | FromDiscord | <Rika> In reply to @iWonderAboutTuatara "what does the semicolon": if you do `[T, V: not T]` then T is not T somehow |
17:08:59 | FromDiscord | <Elegantbeef> The same thiing it does anywhere else |
17:09:09 | FromDiscord | <Tuatarian> it says `undeclared identifier: 'T'` |
17:09:14 | FromDiscord | <Rika> thats why i said |
17:09:17 | FromDiscord | <Rika> to use the semicolon |
17:09:17 | FromDiscord | <Tuatarian> if you don't do the semicolon |
17:09:18 | FromDiscord | <Tuatarian> but why |
17:09:24 | FromDiscord | <Tuatarian> thanks btw that works |
17:09:24 | FromDiscord | <Rika> because it spreads the not T type |
17:09:28 | FromDiscord | <Rika> to T as well |
17:09:31 | FromDiscord | <Rika> like in parameters |
17:09:34 | FromDiscord | <Rika> `(a, b: int` |
17:09:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=46Wa |
17:09:39 | FromDiscord | <Rika> (edit) "`(a," => "`proc a(a," | "int`" => "int)`" |
17:09:40 | FromDiscord | <Rika> same idea |
17:09:52 | FromDiscord | <Rika> In reply to @Isofruit "You mean to have": jesus christ |
17:10:00 | FromDiscord | <Rika> youre gonna kill the man with java-nim code |
17:10:07 | FromDiscord | <Phil> In reply to @Rika "youre gonna kill the": Then write it cleaner |
17:10:34 | FromDiscord | <Rika> you dont have to use this example itself though |
17:10:41 | FromDiscord | <Elegantbeef> Why doesnt `createUpdateHandler` infer generic parameters? |
17:10:55 | FromDiscord | <Phil> In reply to @Elegantbeef "Why doesnt `createUpdateHandler` infer": It does, but the error messages I get when it doesn't work are baaaaaad |
17:11:07 | FromDiscord | <Sun「無用」> In reply to @Isofruit "You mean to have": what? |
17:11:11 | FromDiscord | <Tuatarian> In reply to @Rika "to T as well": meaning? |
17:11:16 | FromDiscord | <Phil> By having these assignments I at least get to know which proc isn't fitting the signature |
17:11:42 | FromDiscord | <Elegantbeef> I mean ` result = createUpdateHandler(readProc, checkPermissionProc, updateProc, serialize)` |
17:11:43 | FromDiscord | <Phil> If I don't have them all I get from the compiler is "something in there isn't correct" |
17:12:15 | FromDiscord | <Rika> In reply to @iWonderAboutTuatara "meaning?": just like in `(a, b: int)` a and b are both ints, `[T, V: not T]` means that T and V are not T |
17:12:20 | FromDiscord | <Rika> what does T not being T mean |
17:12:26 | FromDiscord | <Phil> That's somewhere between habit and "I never tried it a different way because I got an error once and writing generics in generics finally started working for me once I did it this way" |
17:12:26 | FromDiscord | <Rika> i am not me |
17:12:51 | FromDiscord | <Elegantbeef> And why do you have type annotations |
17:12:53 | FromDiscord | <Phil> In reply to @Sun「無用」 "what?": You asked for a syntax example for higher order functions, well procs |
17:13:01 | FromDiscord | <Elegantbeef> Like what's the point there |
17:13:39 | FromDiscord | <Sun「無用」> In reply to @Isofruit "You asked for a": Lol, I didn't understand even a bit of it |
17:13:53 | * | arkanoid quit (Ping timeout: 255 seconds) |
17:14:28 | FromDiscord | <Phil> In reply to @Sun「無用」 "Lol, I didn't understand": Alright, different approach then |
17:15:09 | FromDiscord | <Rika> In reply to @Isofruit "You asked for a": as ive said the example you gave was too complicated and had way too much unnecessary inclusions xd |
17:15:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Wd |
17:15:47 | FromDiscord | <Rika> that works |
17:15:48 | FromDiscord | <Rika> beef quick |
17:16:04 | FromDiscord | <Sun「無用」> lol |
17:16:10 | FromDiscord | <Sun「無用」> sent a code paste, see https://paste.rs/wSS |
17:16:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=46Wf |
17:16:29 | FromDiscord | <Phil> You can combine that with type aliases to make it more readable |
17:16:30 | * | ggsx quit (Ping timeout: 252 seconds) |
17:16:38 | FromDiscord | <Sun「無用」> Anyways, I won't use that anymore |
17:16:41 | FromDiscord | <Phil> So that your procs don't have to eat an entire proc definition |
17:16:46 | FromDiscord | <Sun「無用」> Just moved the things to another file |
17:16:48 | FromDiscord | <Rika> In reply to @Sun「無用」 "Anyways, I won't use": ? |
17:16:50 | FromDiscord | <Rika> okay |
17:17:52 | FromDiscord | <Sun「無用」> In reply to @Rika "?": The way I was going to do was unreadable and unusable |
17:18:09 | FromDiscord | <Rika> okay |
17:18:09 | FromDiscord | <Elegantbeef> phil must really be rubbing off on you |
17:18:26 | FromDiscord | <Elegantbeef> Sorry phil i couldnt help myself |
17:18:32 | FromDiscord | <Phil> 🙄 |
17:19:03 | FromDiscord | <Tuatarian> In reply to @Rika "just like in `(a,": OH, that makes a lot of sense |
17:19:07 | FromDiscord | <Tuatarian> thanks |
17:19:14 | FromDiscord | <Tuatarian> the semicolon separates the statements |
17:19:17 | FromDiscord | <Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46Wj |
17:19:27 | FromDiscord | <Rika> ye |
17:19:37 | FromDiscord | <Tuatarian> In reply to @Sun「無用」 "Lol, I didn't understand": that was possibyl the worst example I've ever seen anyone give of anything, so no worries |
17:19:51 | FromDiscord | <Tuatarian> In reply to @Sun「無用」 "I'd have to do": using sugar, you cna avoid a lot of typing |
17:19:56 | FromDiscord | <Phil> throws hands in the air↵Apparently I'll just go make dinner then |
17:20:30 | FromDiscord | <Elegantbeef> sorry not sorry |
17:20:47 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=46Wk |
17:20:57 | FromDiscord | <Tuatarian> (edit) "https://play.nim-lang.org/#ix=46Wk" => "https://play.nim-lang.org/#ix=46Wl" |
17:21:02 | FromDiscord | <Rika> cursed spacing |
17:21:03 | FromDiscord | <Tuatarian> (edit) |
17:21:06 | FromDiscord | <Rika> someone ban him |
17:21:08 | FromDiscord | <Rika> smh |
17:21:09 | FromDiscord | <Tuatarian> oops lmao |
17:21:17 | FromDiscord | <treeform> In reply to @ajusa "do folks have a": Yeah it's very simple, we like it. |
17:21:25 | FromDiscord | <Tuatarian> (edit) "https://play.nim-lang.org/#ix=46Wl" => "https://play.nim-lang.org/#ix=46Wm" |
17:22:13 | FromDiscord | <Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46Wn |
17:22:55 | FromDiscord | <Tuatarian> same amount of readable imo |
17:22:58 | FromDiscord | <Sun「無用」> ? |
17:23:08 | FromDiscord | <Sun「無用」> in one, I need to pass board, bot and input func |
17:23:15 | FromDiscord | <Sun「無用」> the other I just need the game object |
17:29:39 | FromDiscord | <voidwalker> was there any special syntax for that `for k, v in ` loop ? so I have a k start starts from 0 |
17:29:52 | FromDiscord | <voidwalker> (edit) "was there any special syntax ... for" added "or limitations" |
17:32:41 | FromDiscord | <Tuatarian> is there a container type? |
17:34:52 | FromDiscord | <Rainbow Asteroids> wdym by container type? There's `openArray` |
17:35:07 | FromDiscord | <Tuatarian> does openArray encomass sets? |
17:36:39 | FromDiscord | <Elegantbeef> No |
17:37:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WA |
17:47:08 | FromDiscord | <Rika> In reply to @voidwalker "was there any special": wdym? |
17:47:41 | FromDiscord | <Rika> `for k, v in x` is just `for a in x.pairs: let (k, v) = a; ...` i believe |
17:55:45 | FromDiscord | <Forest> What's the Nim equivalent of Pythonic? |
17:55:49 | FromDiscord | <Forest> I've been saying Nimatic lmao |
17:56:39 | FromDiscord | <Rika> there is none |
17:56:43 | FromDiscord | <Rika> just say idiomatic |
17:56:55 | FromDiscord | <Forest> Nimatic it is /lh |
17:56:57 | FromDiscord | <Rika> ok |
17:58:38 | FromDiscord | <reversem3> Yeah , I'm trying to figure that out also.↵(@Forest) |
17:59:15 | FromDiscord | <Phil> In reply to @Forest "I've been saying Nimatic": ~~nimiotic obviously~~ |
17:59:31 | FromDiscord | <Elegantbeef> You link to it then write the code as you would in C |
18:00:04 | FromDiscord | <Forest> In reply to @reversem3 "Yeah , I'm trying": Sweet |
18:00:09 | FromDiscord | <Elegantbeef> If it's a dynamic library you pass `-lmyLibName` if it's a static library you pass `-static -lmyLibName` if it's source code you use `{.compile.}` |
18:00:24 | FromDiscord | <Forest> {.compile.} on the header file? |
18:00:34 | FromDiscord | <Forest> For source code |
18:00:43 | FromDiscord | <Forest> Hopefully futhark will work on Windows lmao |
18:00:47 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WG |
18:00:51 | FromDiscord | <voidwalker> ` Error: wrong number of variables` |
18:00:55 | FromDiscord | <voidwalker> What am I missing here? |
18:01:13 | * | wallabra quit (Ping timeout: 268 seconds) |
18:01:39 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WH |
18:01:46 | FromDiscord | <voidwalker> where tsv.row is CsvRow type |
18:04:35 | FromDiscord | <choltreppe> sent a code paste, see https://paste.rs/th9 |
18:05:11 | FromDiscord | <Elegantbeef> What's the template definition? |
18:05:31 | FromDiscord | <Elegantbeef> Worth noting the error says `exp.right.exp.left.val` |
18:05:42 | FromDiscord | <Elegantbeef> not `exp.right, exp.left.val` |
18:06:50 | FromDiscord | <choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=46WJ |
18:07:24 | FromDiscord | <Elegantbeef> everywhere you see `val` it's replaced with the template parameter |
18:07:40 | FromDiscord | <choltreppe> ah yes |
18:07:47 | FromDiscord | <choltreppe> ofcourse |
18:07:57 | FromDiscord | <Elegantbeef> so that `other.val` is turned into `other.val.exp.left.val` |
18:07:57 | FromDiscord | <choltreppe> thanks |
18:08:27 | FromDiscord | <Rika> In reply to @voidwalker "What am I missing": needs more info |
18:08:33 | FromDiscord | <Rika> cant tell from just this |
18:08:46 | FromDiscord | <reversem3> Is there a way to pull out everything from the c file from Futhark ? besides disassembling it? |
18:08:54 | FromDiscord | <Elegantbeef> What? |
18:09:31 | FromDiscord | <Elegantbeef> Futhark wraps the entire C library so it should be like it's C |
18:11:46 | FromDiscord | <reversem3> Ok so what PMunch said to do if leave out the static and just add all the paths to the header files and run , so I did that and now I have a binary file. |
18:12:53 | FromDiscord | <Elegantbeef> Yea that's all you should need to do |
18:13:05 | FromDiscord | <reversem3> I don't have a c file though |
18:13:18 | FromDiscord | <Elegantbeef> I dont follow |
18:13:45 | FromDiscord | <Elegantbeef> You have a library futhark wrapped, is it a source, static or dynamic library? |
18:14:02 | FromDiscord | <reversem3> file enim↵enim\: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=925a9df422031d32717491fb07a523e68a139a37, for GNU/Linux 4.4.0, with debug\_info, not stripped |
18:14:41 | FromDiscord | <reversem3> ok so dynamic |
18:15:04 | FromDiscord | <Elegantbeef> So then you have to link the library using `-lmylibname` |
18:15:29 | FromDiscord | <voidwalker> In reply to @Rika "`for k, v in": I believe you are right, I had the idea that the k was just an extra increment value so you don't have it inside the loop. |
18:15:41 | FromDiscord | <voidwalker> `iterator pairs[T](a: seq[T]): tuple[key: int, val: T] {.inline.}` |
18:16:22 | FromDiscord | <Elegantbeef> This should be `--passL:"-lmyLibName"` if unclear |
18:16:37 | FromDiscord | <Elegantbeef> Or in nim as `{.passL:"-lmylibName".}` |
18:17:20 | FromDiscord | <voidwalker> and because I have filter, which is in an iterator it seems, does not return a new seq.. I cannot use k, val there |
18:17:28 | FromDiscord | <Elegantbeef> An example of this https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L33-L40 |
18:18:57 | FromDiscord | <reversem3> Ok , so this is weird in nim , is there some documentation you can put to me so I can figure this out? Because how can I see what Futhark did or changed? |
18:19:17 | FromDiscord | <deech> Why is `hasKeyOrPut` take a `var TableRef` instead of just `TableRef`? A `TableRef` is already a mutable. https://github.com/nim-lang/Nim/blob/efdcc0016913918eb303f5c34ae805b94f270a1a/lib/pure/collections/tables.nim#L920 |
18:19:57 | FromDiscord | <deech> (edit) removed "a" |
18:20:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WN |
18:20:06 | FromDiscord | <Elegantbeef> With strict funcs this isnt true↵(@deech) |
18:20:36 | FromDiscord | <flywind> In reply to @deech "Why is `hasKeyOrPut` take": I don't know, but we can use git blame |
18:21:12 | FromDiscord | <deech> With `strictFuncs` the reference may be immutable but the underlying table should be mutable. |
18:21:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WO |
18:21:22 | FromDiscord | <Elegantbeef> No it shouldnt be |
18:21:40 | FromDiscord | <Elegantbeef> Strict funcs explicitly states pointers do not elude side effect tracking |
18:21:57 | FromDiscord | <voidwalker> In reply to @Elegantbeef "Why you dont do": Cause I'm messy dogmeat : D |
18:21:58 | FromDiscord | <Elegantbeef> The entire point of it is to make it so you have to declare parameters as `var` to mutate them including references |
18:22:27 | FromDiscord | <deech> I see, then with `strrictFuncs` is `ref` simply a signal that it should be ref-counted? |
18:22:45 | FromDiscord | <Elegantbeef> Yes `ref` indicates it's a reference with strictFuncs |
18:23:23 | FromDiscord | <deech> Great, thanks! That clears it up and I even like it better. |
18:23:46 | FromDiscord | <Elegantbeef> Strict funcs is great |
18:24:23 | FromDiscord | <Elegantbeef> I have no clue why it's actually `var` but we'll go with my joke answer |
18:24:38 | FromDiscord | <deech> It should be the default for the standard library. |
18:25:08 | FromDiscord | <voidwalker> In reply to @Elegantbeef "Why you dont do": I will need k to be the actual number of filetered elements though, so I can break when it reaches max |
18:25:21 | FromDiscord | <Elegantbeef> So increment a counter? |
18:25:27 | FromDiscord | <voidwalker> one more line ? :\ |
18:25:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WP |
18:26:00 | FromDiscord | <Elegantbeef> Yea it's really a shame that code has to be written |
18:27:01 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WQ |
18:27:27 | FromDiscord | <Elegantbeef> I'm glad i'm going for a bit cause that's just awful |
18:27:54 | FromDiscord | <voidwalker> Would it be the general consensus that it's awful ? |
18:28:12 | FromDiscord | <Elegantbeef> You're allocating 3 sequences just cause you dislike vertical code |
18:28:16 | FromDiscord | <Elegantbeef> So probably |
18:28:37 | FromDiscord | <Forest> How do i make futhark ignore system bindings |
18:28:42 | FromDiscord | <Forest> Headers |
18:28:43 | FromDiscord | <voidwalker> I thought it's not much more inefficient vs yours |
18:28:53 | FromDiscord | <Elegantbeef> It's much more inefficient |
18:28:59 | FromDiscord | <Forest> Since i have these showing up, when i only want things related to futhark to show up if possible https://media.discordapp.net/attachments/371759389889003532/1005905411263696996/Screenshot_2022-08-07-19-27-51-997_com.termux.jpg |
18:29:05 | FromDiscord | <Elegantbeef> `filter` allocates a sequence `toSeq` allocates a sequence |
18:29:13 | FromDiscord | <flywind> In reply to @deech "It should be the": Here is the first commit => https://github.com/nim-lang/Nim/commit/0a3e732b9ffc58d77f8821da64d2a31f8e894e6b |
18:29:36 | FromDiscord | <Elegantbeef> The reason it's var is probably due to copy pasting |
18:30:22 | FromDiscord | <voidwalker> oh so even if filter is an iterator, is still allocate a sequence ? |
18:30:31 | FromDiscord | <Elegantbeef> It's not an iterator |
18:30:59 | FromDiscord | <Elegantbeef> Oh nvm there is an iterator variant |
18:31:09 | FromDiscord | <Elegantbeef> Ok so never mind you allocate 1 extra sequence |
18:32:39 | FromDiscord | <Elegantbeef> So the answer is to quit using `toSeq` and `import std/enumerate` then do `for k, v in enumerate myHtml.findAll(...).filter(...):` |
18:33:00 | FromDiscord | <Elegantbeef> And just like that you have a non allocating variation of your code |
18:33:13 | FromDiscord | <flywind> In reply to @Elegantbeef "The reason it's var": True, and `mgetOrPut` doesn't have a var until now. |
18:33:51 | FromDiscord | <voidwalker> wait, there is a proc filter too.. withe the same parameters.. how does it choose which one to use ? |
18:34:03 | FromDiscord | <Elegantbeef> Iterators are only chosen in specific cases |
18:34:25 | FromDiscord | <Elegantbeef> inside for loops, inside `typeof`(by default) and when a template has `iterable` as a parameter |
18:35:10 | FromDiscord | <flywind> In reply to @flywind "True, and `mgetOrPut` doesn't": https://media.discordapp.net/attachments/371759389889003532/1005906967237251152/unknown.png |
18:35:28 | FromDiscord | <flywind> inconsistent |
18:45:34 | FromDiscord | <flywind> It is a breaking change though, I hope it can pass the CI. => https://github.com/nim-lang/Nim/pull/20175 |
18:47:42 | FromDiscord | <deech> Will function dispatch pick the right one if you simply add a `hasKeyOrPut` instead changing the existing one? |
18:48:14 | FromDiscord | <flywind> Yeah, it should. |
18:49:32 | FromDiscord | <voidwalker> Thank you for the enumerate suggestion Elegantbeef, looks like the right compromise |
18:51:14 | FromDiscord | <flywind> In reply to @deech "Will function dispatch pick": Yeah, I should. |
18:51:29 | FromDiscord | <flywind> https://play.nim-lang.org/#ix=46WW |
18:52:08 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WX |
18:52:34 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WY |
18:52:41 | FromDiscord | <voidwalker> should they not be equivalent ? |
18:55:06 | FromDiscord | <voidwalker> seems the first ones keeps downloading that webpage, but why ? |
18:55:56 | FromDiscord | <voidwalker> ah, maybe it tries to iterate over the string returned by getContent ? |
19:06:28 | FromDiscord | <tandy> @pmunch know how to fix `/usr/bin/ld: cannot find -lclang` when installing futhark? |
19:07:56 | FromDiscord | <tandy> i need clang-devel, nvm |
19:11:58 | FromDiscord | <EyeCon> What should I use for linting/checking Nim code nowadays? |
19:12:09 | FromDiscord | <!&luke> Nimpretty |
19:18:08 | FromDiscord | <Rika> That’s for formatting |
19:21:16 | FromDiscord | <!&luke> It also check if it won't compile |
19:25:36 | FromDiscord | <Rika> You can do that with "nim check" |
19:25:55 | FromDiscord | <Mike> I think you're just doing `parseHtml` for every iteration of the loop.↵(@voidwalker) |
19:25:59 | * | kenran joined #nim |
19:26:15 | * | kenran quit (Client Quit) |
19:39:43 | FromDiscord | <Elegantbeef> Yea the enumerate probably causes this |
19:44:39 | * | wallabra joined #nim |
19:49:18 | * | wallabra_ joined #nim |
19:50:59 | * | wallabra quit (Ping timeout: 268 seconds) |
19:51:01 | * | wallabra_ is now known as wallabra |
19:53:39 | FromDiscord | <reversem3> Elegantbeef\: so basically Futhark created a dynamic library based on all the header files I gave it correct? |
20:03:34 | FromDiscord | <Elegantbeef> No |
20:03:37 | FromDiscord | <Elegantbeef> Futhark wrapped the C code that's all it did |
20:03:57 | FromDiscord | <Elegantbeef> It iterated over the C code extracted the type defs and procedures and imported them into nim |
20:25:44 | FromDiscord | <reversem3> so... how would you use them then |
20:25:57 | FromDiscord | <Elegantbeef> It depends on what the library is like i've said about 10 times now |
20:26:32 | FromDiscord | <Elegantbeef> If it's a static or dynamic library you link those accordingly, if it's source you tell nim to compile a file that includes it |
20:28:50 | FromDiscord | <reversem3> Sorry man , just trying to wrap my head around this. |
20:29:08 | FromDiscord | <Elegantbeef> Well what library are you attempting to wrap? |
20:29:53 | FromDiscord | <reversem3> https://git.enlightenment.org/enlightenment/efl/src/branch/master/src/lib/elementary |
20:30:29 | FromDiscord | <Elegantbeef> Ok so i assume you have something like `libelementary.so`? |
20:31:34 | FromDiscord | <reversem3> I don't think it works that way , EFL is a bunch of different libraries in order to create EFL apps. |
20:32:47 | FromDiscord | <reversem3> Yes I do |
20:33:09 | FromDiscord | <Elegantbeef> Then you should be able to just do `{.passL:"-lelementary".}` |
20:41:10 | FromDiscord | <Mike> Hey, does anybody have any notion of how to use something like a weak pointer? |
20:41:49 | FromDiscord | <matkuki> sent a code paste, see https://play.nim-lang.org/#ix=46Xo |
20:43:34 | FromDiscord | <Elegantbeef> With orc/arc you can do `{.cursor.}` which is kinda like a weak pointer |
20:43:34 | FromDiscord | <Mike> I saw a mention of that but haven't found any docs. I am using orc so if that works that would be great |
20:43:34 | FromDiscord | <Mike> Are there any examples anywhere? |
20:43:34 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation |
20:43:37 | FromDiscord | <Elegantbeef> It's not identical to C++'s weak pointer as the docs say but it can be somewhat used like it |
20:43:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Xp |
20:46:04 | FromDiscord | <Mike> So if a goes out of scope and gets destroyed, b becomes nil? Can I just check with `b.isNil` whenever I want to try and use it? |
20:46:59 | FromDiscord | <Elegantbeef> No b doesnt become nil |
20:47:55 | FromDiscord | <Elegantbeef> Actually it might be considered `isNil` since the ref count is decremented |
20:47:57 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xr |
20:48:07 | FromDiscord | <tandy> sent a code paste, see https://paste.rs/60O |
20:48:48 | FromDiscord | <Mike> So is there any way for me to check that whatever b is pointing to hasn't been destroyed yet? |
20:51:40 | FromDiscord | <Elegantbeef> No clue |
20:52:54 | FromDiscord | <domosokrat> Can this even happen? Since b has to be in the same or deeper scope than a? |
20:53:20 | FromDiscord | <domosokrat> Forget it, of course if you destroy a manually |
20:54:09 | FromDiscord | <Elegantbeef> No one destroys objects manually with Orc 😛 |
20:54:38 | FromDiscord | <Mike> Yeah I'm hoping to be able to create a new `ref MyObject`, also create a weak pointer to it, and then when it goes out of scope my weak pointer just becomes nil or invalid or whatever |
20:54:57 | FromDiscord | <Mike> Basically I want to be able to do updates to `MyObject`, but not retain it |
20:55:41 | FromDiscord | <Elegantbeef> Yea cursor is practically just a pointer, Nim presently doesnt have a weak pointer for refs |
20:56:05 | FromDiscord | <Mike> hmm, alright so maybe I just need to let that idea go for now |
20:57:26 | FromDiscord | <Mike> Thank you though. At least I have some clarity on that |
20:57:59 | FromDiscord | <leorize> if you really want it it can be done with a form of custom "pointer", but it's more trouble than it's worth |
20:59:50 | FromDiscord | <Mike> Yeah I think I'm just going to look for alternative ways of doing what I want to do here. I do hope something along those lines makes it into Nim eventually. Coming from C++/Swift/Objective-C it's a nice pattern for certain scenarios |
21:01:05 | FromDiscord | <Elegantbeef> It's a weird thing cause you have to invalidate the pointers somehow |
21:02:59 | FromDiscord | <leorize> a trick used in game dev for this is a generational array |
21:03:22 | FromDiscord | <leorize> your "pointer" is the index with a few bits used for marking its "generation" |
21:04:11 | FromDiscord | <leorize> once the array slot is cleared, you update the slot generation, and the "pointer" is now of an older generation and can be treated as invalid |
21:06:16 | FromDiscord | <Mike> How do clear the array slot? Are you rebuilding this array every game loop or something? |
21:07:31 | FromDiscord | <leorize> you can just mark it as empty, releasing memory is pretty expensive so better avoid it if possible |
21:07:44 | FromDiscord | <tandy> oh now it says `Fatal: 'stddef.h' file not found` |
21:09:15 | FromDiscord | <Mike> I don't totally get it, but I'll read up on generational arrays a little bit. |
21:10:14 | FromDiscord | <leorize> I just realized that the term I use is pretty much ungooglable. I found out about this strategy from here\: https://floooh.github.io/2018/06/17/handles-vs-pointers.html and some other gamedev blogs that I don't remember |
21:10:38 | FromDiscord | <Elegantbeef> It's really not idea but you can also do something like https://play.nim-lang.org/#ix=46Xv |
21:11:03 | FromDiscord | <leorize> you can also do a `ref ref` \:P |
21:11:16 | FromDiscord | <Elegantbeef> The validity of the reference is tracked in yet more GC'd memory either way |
21:13:31 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
21:13:32 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xy |
21:14:16 | FromDiscord | <Elegantbeef> Did you provide futhark with the proper path |
21:14:25 | * | neceve quit (Ping timeout: 252 seconds) |
21:14:45 | FromDiscord | <tandy> just fixed that, back to segfaulting \:) |
21:15:06 | FromDiscord | <Elegantbeef> Why do you define `LIBANTUMBRA_H`? |
21:15:24 | FromDiscord | <Mike> So when you go to check `a.isValid[]`, what happens if `WeakBase` has been destroyed? Couldn't that be accessing dead memory? |
21:15:24 | FromDiscord | <Elegantbeef> https://github.com/TeamAntumbra/libantumbra/search?q=LIBANTUMBRA_H it's not a symbol |
21:15:27 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xz |
21:15:27 | FromDiscord | <tandy> good question |
21:15:54 | FromDiscord | <Elegantbeef> You have the `.so` in your library path? |
21:16:00 | FromDiscord | <tandy> oh i initially did AN\_LIBANTUMBRA\_H |
21:16:06 | FromDiscord | <Elegantbeef> I assume so else it'd error |
21:16:09 | FromDiscord | <tandy> cos thats the header definition |
21:16:12 | FromDiscord | <Elegantbeef> Yea and that's going to give you nothing |
21:16:17 | FromDiscord | <tandy> yesir |
21:16:19 | FromDiscord | <tandy> tested |
21:16:21 | FromDiscord | <Elegantbeef> The reason that pmunch defines anything in the futhark example is causue the C required it |
21:16:46 | FromDiscord | <Elegantbeef> Ok where does it segfault |
21:17:48 | FromDiscord | <tandy> opir |
21:17:53 | FromDiscord | <tandy> opir -I/usr/lib64/clang/14.0.0/include -I/home/tandy/libantumbra /home/tandy/.cache/nim/antumbra\_d/futhark-includes.h |
21:18:24 | FromDiscord | <Elegantbeef> No cause `WeakRef` keeps the `ref bool` alive |
21:18:45 | FromDiscord | <Mike> ahhhhh yep, I get it |
21:18:57 | FromDiscord | <Elegantbeef> Tandy that means something in the C code is causing opir to crashy crash try with a debug version of opir to see if it helps any |
21:19:00 | FromDiscord | <Mike> ...that really isn't the worst idea. I kinda like that |
21:19:10 | FromDiscord | <tandy> thanks, will do |
21:19:41 | FromDiscord | <Elegantbeef> The ref ref is of course simpler 😄 |
21:19:52 | FromDiscord | <tandy> can i use nimble to install as debug? |
21:19:57 | FromDiscord | <Elegantbeef> No clue |
21:26:30 | FromDiscord | <Elegantbeef> Mike this might also give some inspiration https://github.com/zielmicha/collections.nim/blob/master/collections/weakref.nim |
21:29:25 | FromDiscord | <Mike> Ah, I also just found this, which is very interesting\: https://github.com/henryas/nptr |
21:30:16 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim and this! |
21:31:42 | FromDiscord | <ajusa> Is there a library that supports custom http methods? |
21:31:43 | FromDiscord | <Mike> lol what |
21:31:55 | FromDiscord | <ajusa> Looks like 1.6 removed them |
21:33:02 | * | wallabra quit (Ping timeout: 255 seconds) |
21:33:10 | FromDiscord | <tandy> no luck \:k |
21:33:39 | FromDiscord | <Elegantbeef> Well make an issue for pmunch to deal with |
21:34:56 | * | wallabra joined #nim |
21:35:42 | FromDiscord | <Mike> Is this stuff actually shipped with nim, or is this experimental? |
21:35:49 | FromDiscord | <Elegantbeef> It's in that package |
21:37:25 | FromDiscord | <Mike> ah okay |
21:46:05 | FromDiscord | <sekao> In reply to @luteva "Hi! I was trying": this is a ridiculously late reply, but the 100% CPU in nimwave_starter can be fixed by using glfwWaitEvents. i just updated the project to use it |
21:54:44 | FromDiscord | <Forest> Question, how do you automate making bindings? Is it just string manipulation? |
21:55:04 | FromDiscord | <Elegantbeef> futhark uses clang to parse the C code and emit nim code |
21:55:26 | FromDiscord | <Forest> Yeah but futhark isn't exactly the cleanest |
21:55:45 | FromDiscord | <Elegantbeef> C2nim operates on the string and parses everything as close as it can |
21:55:45 | FromDiscord | <Forest> I'm planning on piggybacking off of futhark's outputted json though |
21:56:00 | FromDiscord | <Elegantbeef> You're best to piggyback on the output nim code |
21:56:25 | FromDiscord | <Forest> And just clean that up instead? Or make manual bindings ontop of the outputted Nim code? |
21:56:29 | FromDiscord | <Forest> Or can it also be automated |
21:56:34 | FromDiscord | <Elegantbeef> Manual bindings on top |
21:56:39 | FromDiscord | <Forest> Alright, thanks! |
21:59:14 | FromDiscord | <Forest> Would using templates for as much as we possibly can be good for speed at all or? |
21:59:21 | FromDiscord | <Forest> Just aliasing it to nicer names |
21:59:43 | FromDiscord | <Elegantbeef> Templates or annotated inlined procedure is probably fine |
22:01:59 | FromDiscord | <Forest> Annotated inline what- |
22:02:08 | FromDiscord | <Forest> Ik what a proc is, but never heard of that before |
22:02:18 | FromDiscord | <Elegantbeef> `proc myAlias() {.inline.}` |
22:02:53 | FromDiscord | <Forest> Huh, and that works the same as templates? |
22:03:11 | FromDiscord | <Elegantbeef> It tells the C compiler to inline it if it wants to |
22:03:25 | FromDiscord | <Elegantbeef> It generally will be about the same as template if you use release and LTO |
22:08:14 | FromDiscord | <Forest> Ah alright, thanks! |
22:08:30 | FromDiscord | <Forest> What's the different pros and cons if i can ask? |
22:16:12 | FromDiscord | <matkuki> Ok, so I found that changing the `nimbase.h` line 464 from `typedef char NCSTRING;` to `typedef const char NCSTRING;` fixes the Windows MSVC problem. Is there a way to redefine this typedef just for my code, without touching `nimbase.h`?↵Thanks |
22:17:58 | FromDiscord | <leorize> note that templates can feature delayed evaluation depends on how you write it, but procedures parameters are always evaluated↵(@Forest) |
22:18:11 | * | CyberTailor quit (Remote host closed the connection) |
22:18:26 | FromDiscord | <leorize> unfortunately not, what is the issue that you're having?↵(@matkuki) |
22:21:18 | FromDiscord | <Forest> In reply to @leorize "note that templates can": Ah okay, thanks! |
22:22:40 | FromDiscord | <matkuki> sent a code paste, see https://play.nim-lang.org/#ix=46XN |
22:23:22 | FromDiscord | <leorize> hmm, how come strictStrings are enabled by default for you? |
22:23:50 | FromDiscord | <leorize> you can add `/Zc:strictStrings-` to `passC` to disable that function |
22:24:14 | FromDiscord | <leorize> it makes sense when used with hand-written C, but Nim's C is not handwritten C and safety analysis has already been done at the Nim level |
22:26:01 | FromDiscord | <matkuki> I don't have that flag present, but tried addind `/Zc:strictStrings-`, no change.↵Also tried adding the `/permissive` flag, but that conflicts with rest of the `Qt` compilation process. |
22:27:04 | FromDiscord | <leorize> that's certainly weird \:/ |
22:27:57 | FromDiscord | <leorize> while modifying nimbase will fix that particular problem, it might cause issues elsewhere since `NCSTRING` is used for all `cstring` declaration in Nim, and some of them are mutable |
22:28:07 | FromDiscord | <huantian> are you using `--cc:vcc`? I think that's the flag |
22:28:34 | FromDiscord | <matkuki> @leorize↵Got it, thank you very much for the suggestion!!!! Reversing the flag order fixed it: `/Zc:strictStrings-` has to come last! |
22:28:45 | * | CyberTailor joined #nim |
22:29:04 | FromDiscord | <matkuki> @huantian Yes, I'm using that flag. |
22:29:41 | FromDiscord | <matkuki> (edit) "@leorize↵Got" => "@leorize Got" |
23:00:26 | FromDiscord | <Forest> Is retyping (https://github.com/PMunch/futhark#redefining-types) a built-in Nim feature or futhark specific? |
23:00:36 | FromDiscord | <Forest> If it's futhark specific, how could i use it without futhark installed? |
23:01:34 | * | vicecea quit (Remote host closed the connection) |
23:02:05 | * | vicecea joined #nim |
23:02:19 | FromDiscord | <leorize> the description pretty much describes what it does \:p |
23:03:19 | FromDiscord | <leorize> in short, in C some types are ambiguous\: arrays are pointers, and pointers are arrays, arrays of arrays are double pointers and var array is also double pointers |
23:03:57 | FromDiscord | <Forest> Yeah but is `retype <object>.<field>, <Nim type>` a built-in Nim feature? Reading the desc didn't make it clear to me aha |
23:04:32 | FromDiscord | <leorize> in Nim we separate it into different concepts, but the underlying representation is the same, so you can use equivalent types to add safety and context in a Nim wrapper |
23:05:15 | FromDiscord | <Forest> Ah okay, thanks! |
23:20:14 | FromDiscord | <Elegantbeef> It's a futhark feature that replaces the type in the generated nim files↵(@Forest) |
23:21:45 | FromDiscord | <Forest> Ah okay |
23:21:59 | FromDiscord | <Forest> But wait then how does `retype` know to change the fields? |
23:22:30 | FromDiscord | <Elegantbeef> Cause it takes the field access as a parameter? |
23:22:46 | FromDiscord | <Elegantbeef> It's wrapping C code `a.b` in C is only one thing |
23:23:31 | FromDiscord | <Forest> Wait so, I should put `retype` after the importc statement? |
23:23:45 | FromDiscord | <Elegantbeef> Retype only works in the importc macro |
23:23:58 | FromDiscord | <Forest> Oh in the macro |
23:24:00 | FromDiscord | <Forest> Thanks aha |
23:42:26 | NimEventer | New post on r/nim by junyup: 2 questions about nim memory management, see https://reddit.com/r/nim/comments/witmh3/2_questions_about_nim_memory_management/ |
23:45:06 | * | adium joined #nim |