00:06:52 | FromDiscord | <! Nilts> how to i echo indented json? |
00:07:09 | FromDiscord | <Rika> https://nim-lang.org/docs/json.html#pretty%2CJsonNode%2Cint |
00:07:25 | FromDiscord | <! Nilts> thanks |
00:09:10 | FromDiscord | <! Nilts> yay! my `TomlValueRef` to `JsonNode` converter is complete! |
00:12:42 | FromDiscord | <gibson> Anyone know of good examples/repos using the flatty serialization library? I'd love to see how folks are solving serialization for complex structures. |
00:14:05 | FromDiscord | <Elegantbeef> What do you mean it's just `toFlatty`/`fromFlatty` |
00:16:29 | FromDiscord | <qb> btw. Is there no support for `Toml.to(object`? |
00:16:57 | FromDiscord | <qb> I would need to use `Toml.toJson().to(object)` huh? |
00:17:26 | FromDiscord | <qb> (edit) "`Toml.to(object`?" => "`Toml.to(object)`?" |
00:19:24 | FromDiscord | <gibson> My structures have some references that involve recursion. I can override the `toFlatty` for those references to do the right thing and avoid all that, but for some reason I must be doing it wrong because some other fields then are deserializing from the wrong memory and I get bogus numbers for simple float fields. |
00:37:15 | FromDiscord | <gibson> Just curious how overriding `toFlatty` looks for real world cases. |
01:07:58 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
01:25:47 | FromDiscord | <Array in a Matrix> sent a code paste, see https://paste.rs/0Le |
01:26:36 | FromDiscord | <Array in a Matrix> sent a code paste, see https://play.nim-lang.org/#ix=4gbi |
01:28:40 | FromDiscord | <Array in a Matrix> sent a code paste, see https://play.nim-lang.org/#ix=4gbj |
01:29:47 | FromDiscord | <Elegantbeef> `matrix: var seq[seq[float]]` |
01:30:45 | FromDiscord | <Elegantbeef> Parameters are immutable by default in Nim |
01:30:55 | FromDiscord | <Elegantbeef> You need to say "This is a mutable parameter" |
01:33:02 | FromDiscord | <Array in a Matrix> ohh |
01:33:05 | FromDiscord | <Array in a Matrix> thank you |
01:38:16 | * | derpydoo joined #nim |
01:45:41 | FromDiscord | <ChocolettePalette> Unless they're refs and even though mutable refs are kinda pointless |
01:45:55 | FromDiscord | <Elegantbeef> Eh they're still immutable |
01:46:04 | FromDiscord | <Elegantbeef> reference fields are mutable |
01:46:32 | FromDiscord | <Elegantbeef> I wouldnt say mutable references are kinda pointless, if you want to change where it points to you need it |
01:46:58 | FromDiscord | <ChocolettePalette> You can do ref\_variable = new\_value on a ref but it won't do anything actually |
01:48:09 | * | derpydoo quit (Ping timeout: 268 seconds) |
01:48:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gbl |
01:48:24 | FromDiscord | <Elegantbeef> I mean there are reasons you'd want `var MyRef` |
01:48:35 | FromDiscord | <Elegantbeef> If you want to change where a variable points you need it to be mutable |
01:55:44 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
02:00:30 | * | ltriant quit (Ping timeout: 240 seconds) |
02:00:36 | * | Lord_Nightmare joined #nim |
02:02:44 | * | derpydoo joined #nim |
02:08:44 | FromDiscord | <Array in a Matrix> where can i read more about the documentation generated by the nim compiler? |
02:08:59 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/docgen.html |
02:13:19 | FromDiscord | <Array in a Matrix> thanks |
02:46:25 | FromDiscord | <SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbp |
02:46:36 | FromDiscord | <SBG> `Error: unhandled exception: index 2 not in 0 .. 1 [IndexDefect]` |
02:46:43 | FromDiscord | <SBG> is it because its not expecting paramStr(2)? |
02:46:48 | FromDiscord | <Elegantbeef> `paramStr(2)` |
02:47:08 | FromDiscord | <Elegantbeef> `or (paramCount > 2 and paramStr(2) == "--ignore")` |
02:47:15 | FromDiscord | <SBG> ohhh |
02:47:21 | FromDiscord | <SBG> I didn't use brackets |
02:47:23 | FromDiscord | <SBG> I tried and |
02:59:08 | * | arkurious quit (Quit: Leaving) |
03:02:55 | * | vicecea joined #nim |
03:05:27 | FromDiscord | <voidwalker> https://nim-lang.org/docs/sha1.html#SecureHash - how do I turn this into a string? |
03:05:40 | FromDiscord | <voidwalker> (edit) "string?" => "string with the exact same byte values ?" |
03:05:46 | FromDiscord | <Elegantbeef> `$` |
03:05:51 | FromDiscord | <voidwalker> (edit) "?" => "(not the hex respresentation)?" |
03:06:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gby |
03:07:07 | FromDiscord | <voidwalker> oh no ๐ฆ |
03:07:17 | FromDiscord | <Elegantbeef> What? |
03:07:36 | FromDiscord | <voidwalker> that's 4 lines.. I expected a few chars, same line : D |
03:07:53 | FromDiscord | <Elegantbeef> You can also do `Sha1Digest(myDigest)` instead of `import std/typetraits` |
03:08:00 | FromDiscord | <Elegantbeef> I just find `distinctBase` a tinge easier |
03:08:55 | FromDiscord | <Elegantbeef> But i'll hate you |
03:08:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gbA |
03:08:58 | FromDiscord | <Elegantbeef> One statement per line! |
03:09:13 | FromDiscord | <voidwalker> unless it's small trivial staements that are related : P |
03:09:20 | FromDiscord | <Elegantbeef> Regardless |
03:09:55 | FromDiscord | <voidwalker> feels bad you cannot just use the bytes in place to make a string :\ Is it because one is an array and the other a seq? |
03:11:21 | FromDiscord | <Elegantbeef> arrays are static sized and stack allocated, sequences/strings are dynamic heap allocated |
03:11:30 | FromDiscord | <Elegantbeef> You cannot get one to the other without an allocation |
03:32:30 | FromDiscord | <voidwalker> ok, one more topic. I need to write to a file asynchrnously, in random byte ranges. What library should I use, and how does such a thing work ? Do I create an empty file of the needed size first? |
03:32:32 | FromDiscord | <SBG> In reply to @Elegantbeef "`or (paramCount > 2": wait that presented further issues |
03:33:12 | FromDiscord | <SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbC |
03:33:26 | FromDiscord | <Elegantbeef> I believe in you! |
03:33:44 | FromDiscord | <Elegantbeef> `got <int literal(2), proc (): int{.gcsafe, locks: 0.}>` |
03:35:55 | FromDiscord | <Rika> Beef you didnโt call the count function |
03:36:20 | FromDiscord | <Rika> Smh |
03:36:40 | FromDiscord | <SBG> i dont see the issue there |
03:37:00 | FromDiscord | <SBG> or if paramCouter is greater than two, and the second value is equaled to "--ignore" then |
03:37:38 | FromDiscord | <Rika> Count is a function |
03:37:40 | FromDiscord | <Rika> Call it |
03:37:50 | FromDiscord | <Rika> paramCount() > 2 |
03:38:44 | FromDiscord | <SBG> jesus christ |
03:38:50 | FromDiscord | <SBG> i want to curl up into a ball |
03:38:59 | FromDiscord | <SBG> please ignore me |
03:39:15 | FromDiscord | <Rika> Lol itโs fine |
03:39:19 | FromDiscord | <SBG> I want to leave this server now because im embarrsased but I know i'm going to have to join back in only 20 seconds |
03:39:28 | FromDiscord | <Rika> Donโt worry too much |
03:39:42 | FromDiscord | <Rika> Itโs fine |
03:40:07 | FromDiscord | <SBG> wait is the `if not dirExists(virtDir) or (paramCount() > 2 and paramStr(2) == "--ignore"):` 'not' also applying to the second condition |
03:49:22 | FromDiscord | <SBG> So like is the not in if not applying to both of the conditions? |
03:51:09 | FromDiscord | <Elegantbeef> Or is blow |
03:51:11 | FromDiscord | <Elegantbeef> below even |
03:51:15 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#syntax-precedence |
03:55:18 | * | TakinOver joined #nim |
03:58:27 | FromDiscord | <SBG> In reply to @Elegantbeef "Or is blow": what? |
03:58:50 | FromDiscord | <SBG> ohh |
03:59:00 | FromDiscord | <SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbD |
03:59:30 | FromDiscord | <SBG> This should create the directory if it doesn't exist, then if you try to run it again give an error, if you run it with the flag tho it should work |
03:59:31 | FromDiscord | <SBG> it dpesn |
03:59:42 | FromDiscord | <SBG> (edit) "dpesn" => "the --ignore flag runs the else" |
03:59:46 | FromDiscord | <SBG> which is why i asked my question |
04:00:25 | FromDiscord | <Elegantbeef> `not` is done before `or` so `not a or b` is `not(a) or b` |
04:01:52 | FromDiscord | <Elegantbeef> you can also just do `not(dirExists(virtDir))` |
04:01:54 | FromDiscord | <Elegantbeef> is your issue |
04:01:56 | FromDiscord | <Elegantbeef> `paramCount > 2` |
04:01:56 | FromDiscord | <Elegantbeef> `>=` 2 |
04:02:07 | FromDiscord | <SBG> OH right |
04:02:16 | FromDiscord | <SBG> In reply to @Elegantbeef "`not` is done before": makes sense. |
04:08:45 | * | derpydoo quit (Ping timeout: 268 seconds) |
04:08:59 | * | ltriant joined #nim |
04:15:32 | * | ltriant quit (Quit: leaving) |
04:44:59 | FromDiscord | <MilesTheFox> How to enable extended CPU instruction sets? |
04:45:10 | FromDiscord | <MilesTheFox> Like ``-msse4.1``, but in Nim |
04:45:55 | FromDiscord | <Elegantbeef> `--passC:"-msse4.1"` likely |
04:46:07 | FromDiscord | <MilesTheFox> Thank you! |
04:47:32 | FromDiscord | <alicia ใ> why did the dev decide on 2 spaces |
04:47:37 | FromDiscord | <alicia ใ> it is really really hard to read code |
04:49:03 | FromDiscord | <Elegantbeef> You can use any indention level you want |
04:50:57 | FromDiscord | <huantian> 2 spaces is just the general convention |
04:54:53 | FromDiscord | <alicia ใ> In reply to @huantian "2 spaces is just": why though |
04:54:59 | FromDiscord | <alicia ใ> im aware but why is 2 the default |
04:55:02 | FromDiscord | <alicia ใ> its so hard to read |
04:55:35 | FromDiscord | <Rika> Because thereโs a good amount of people here who do not share your opinion |
04:55:36 | FromDiscord | <Elegantbeef> Cause it hides all of the indention hell in the compiler |
04:55:36 | FromDiscord | <Elegantbeef> Jokes aside i assume it's probably a convention from pascal |
04:55:57 | FromDiscord | <alicia ใ> In reply to @Rika "Because thereโs a good": im not flaming, just curious |
04:56:01 | FromDiscord | <alicia ใ> most languages use 4 |
04:56:10 | FromDiscord | <huantian> wait pascal uses 2? |
04:56:11 | FromDiscord | <Rika> No I mean that in a normal way |
04:56:33 | FromDiscord | <Rika> In reply to @alicia ใ "most languages use 4": There are other languages that use 2 |
04:56:42 | FromDiscord | <alicia ใ> i cant think of one |
04:57:12 | FromDiscord | <Rika> Elixir comes to mind |
04:57:16 | FromDiscord | <Rika> Lol |
04:57:26 | FromDiscord | <huantian> uhhh nix expression lang uses 2 spsaces |
04:57:36 | FromDiscord | <Rika> Lol |
04:58:29 | FromDiscord | <alicia ใ> TIL |
04:58:33 | FromDiscord | <alicia ใ> i thought elixir was 4 |
04:59:23 | FromDiscord | <huantian> I think nix uses 2 because it gets omega indented |
05:02:24 | FromDiscord | <Phytolizer> Haskell does too right? |
05:02:34 | FromDiscord | <Phytolizer> Ormolu formatter anyway |
05:03:01 | FromDiscord | <Rika> Iโd think so yes |
05:03:41 | FromDiscord | <Phytolizer> It's strange though, I usually stick to 4 spaces but nim just looks wrong with that much indentation for whatever reason |
05:05:35 | FromDiscord | <huantian> yeah same |
05:05:49 | FromDiscord | <huantian> also nice phytogrow pfp |
05:06:01 | FromDiscord | <huantian> sorry phyto gro |
05:06:30 | FromDiscord | <alicia ใ> In reply to @Phytolizer "It's strange though, I": im not sure why it does but agreed |
05:07:14 | FromDiscord | <Phytolizer> In reply to @huantian "sorry phyto gro": Finally someone recognizes it lol |
05:07:46 | FromDiscord | <Rika> Try finding a language with 3 indent spaces as standard though |
05:07:57 | FromDiscord | <Phytolizer> Or 5 :elmoburn: |
05:08:09 | FromDiscord | <huantian> In reply to @Phytolizer "Finally someone recognizes it": there's probably not many modded mc nerds who are nerdy enough to actually have used phyto gro |
05:08:21 | FromDiscord | <Phytolizer> Or each indent level is the next number in the Fibonacci sequence |
05:08:37 | FromDiscord | <Phytolizer> In reply to @huantian "there's probably not many": Oh yeah it makes total sense |
05:10:36 | FromDiscord | <Rika> In reply to @Phytolizer "Or each indent level": Factorial |
05:11:06 | FromDiscord | <alicia ใ> i like modded mc |
05:11:11 | FromDiscord | <alicia ใ> but no i havent used phyto gro |
05:14:48 | * | rockcavera quit (Remote host closed the connection) |
05:39:52 | FromDiscord | <huantian> Still advocating for a Nim discord server modded mc server |
05:39:56 | FromDiscord | <huantian> ๐ |
05:40:09 | FromDiscord | <Elegantbeef> Be the change you want to be in the world |
05:40:20 | FromDiscord | <Elegantbeef> see but yea |
05:40:23 | FromDiscord | <Elegantbeef> Words are hard |
05:40:30 | FromDiscord | <Elegantbeef> They really are |
05:42:06 | FromDiscord | <huantian> Yeah I might start up one after I finish my play through of Dyson sphere program |
05:42:55 | * | LuxuryMode joined #nim |
05:45:46 | FromDiscord | <huantian> Ngl I am kinda confused what youโre correcting yourself here with |
05:46:50 | FromDiscord | <Elegantbeef> It's "Be the change you want to see in the world" and i was commentating on the thing that was talked about in #offtopic yesterday |
05:47:59 | FromDiscord | <huantian> Huh |
05:48:06 | FromDiscord | <huantian> Maybe I missed that then lol |
05:51:15 | * | NimEventer quit (Ping timeout: 260 seconds) |
05:51:56 | * | NimEventer joined #nim |
06:09:18 | FromDiscord | <Phytolizer> oh that thing |
06:42:53 | * | ixmpp joined #nim |
06:49:20 | * | nisstyre quit (Quit: WeeChat 3.4) |
06:50:40 | FromDiscord | <scarf> does sequtil use iterators |
06:51:39 | FromDiscord | <Elegantbeef> Nope |
06:53:19 | * | nisstyre joined #nim |
06:58:32 | FromDiscord | <scarf> that's a sad news (in terms of performance), is it impossible to implement? |
06:58:51 | FromDiscord | <scarf> (edit) "implement?" => "implement in current syntax?" |
06:58:59 | FromDiscord | <Elegantbeef> You can use closure iterators and reimplement it all, it's not impossible to implement but to be performant it needs optimisations |
06:59:52 | FromDiscord | <Elegantbeef> I do have a chain macro that i'm indifferent about that does allow using `filter`/`map`/`unpack` on an iterator https://github.com/beef331/slicerator/blob/master/tests/tchain.nim |
07:02:00 | FromDiscord | <scarf> abobut optimisations, does it mean using iterators is not enough? |
07:02:08 | FromDiscord | <scarf> (edit) "enough?" => "enough for performance gain?" |
07:02:26 | FromDiscord | <Elegantbeef> Closure iterators are likely slower than `sequtils` but inline will be faster |
07:03:18 | FromDiscord | <Elegantbeef> Inline iterators are as fast as you can feasibly go, closure iterators are slower due to them being pointer procs |
07:04:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc5 |
07:04:22 | FromDiscord | <Elegantbeef> The latter will be faster due to how closures operate |
07:04:23 | FromDiscord | <scarf> sequtil doesn't use `{.inline.}` but `{.closure.}` , could you tell me why? |
07:04:52 | FromDiscord | <Elegantbeef> Cause closure works with `{.nimCall.}` and `{.closure.}` |
07:05:01 | FromDiscord | <Elegantbeef> That's not even the one issue i'm talking about |
07:05:18 | FromDiscord | <Elegantbeef> That also adds a performance cost |
07:05:48 | FromDiscord | <Elegantbeef> The `it` variants are likely faster |
07:06:36 | FromDiscord | <Elegantbeef> With present Nim if you care about memory and speed you do inline iterator -\> closure iterator -\> sequence. Depending on behaviour you need |
07:07:08 | FromDiscord | <scarf> oh, then is sequence fastest among all? |
07:07:15 | FromDiscord | <Elegantbeef> Slowest |
07:07:31 | FromDiscord | <Elegantbeef> Heap allocations are bad |
07:07:34 | FromDiscord | <Elegantbeef> ๐ |
07:07:44 | FromDiscord | <scarf> alright, so if my understanding is correct, sequtil is slow because it uses closure iterators, and it can be rewritten in inline iterators |
07:07:58 | FromDiscord | <Elegantbeef> No seq utils doesnt use closure iterators |
07:08:05 | FromDiscord | <Elegantbeef> It uses sequences which is why it's slow |
07:08:33 | FromDiscord | <scarf> ok, would there be any difficulties from changing its implementation to inline iterator? |
07:08:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc6 |
07:09:23 | FromDiscord | <scarf> ...oh, yeah, I just remembered, any functional programming languages would create a copy of given sequence |
07:09:43 | FromDiscord | <scarf> so in this case sequtil is working as correctly |
07:10:07 | FromDiscord | <Elegantbeef> In many cases that people use sequtils it's "incorrect" |
07:10:13 | FromDiscord | <Elegantbeef> They chain them and or iterate them |
07:10:46 | FromDiscord | <scarf> they look chainable tho |
07:10:52 | FromDiscord | <scarf> (edit) "they look ... chainable" added "very" |
07:10:57 | FromDiscord | <Elegantbeef> They are but that's "incorrect" |
07:11:16 | FromDiscord | <Elegantbeef> Each chain allocates |
07:11:18 | FromDiscord | <scarf> I wonder how functional programming languages handle long chains |
07:11:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc7 |
07:11:29 | FromDiscord | <Elegantbeef> They do an optimisation |
07:11:32 | FromDiscord | <Elegantbeef> Nim doesnt have this optimisation |
07:11:51 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1043060958672723988/image.png |
07:12:07 | FromDiscord | <Elegantbeef> But yea if you care these are the results from that benchmark on slicerator |
07:13:32 | FromDiscord | <scarf> In reply to @Elegantbeef "They do an optimisation": https://github.com/zero-functional/zero-functional looks promising but its `-->` is ugly |
07:13:54 | FromDiscord | <Elegantbeef> Yea it's an alternative |
07:14:01 | FromDiscord | <Elegantbeef> Personally i think `chain` is the right approach |
07:14:03 | FromDiscord | <Elegantbeef> But i dont know |
07:14:57 | FromDiscord | <scarf> In reply to @Elegantbeef "Personally i think `chain`": is it a proc? or `std/chains`? |
07:15:06 | FromDiscord | <Elegantbeef> It's in slicerator |
07:15:10 | FromDiscord | <Elegantbeef> I linked it |
07:15:22 | FromDiscord | <scarf> nice |
07:17:02 | FromDiscord | <scarf> do you plan to include it in stdlib? |
07:17:11 | FromDiscord | <Elegantbeef> Nope |
07:17:40 | FromDiscord | <scarf> yours look very performant tho |
07:18:16 | FromDiscord | <Elegantbeef> It also uses a weird syntax and isnt really FP |
07:18:35 | FromDiscord | <Elegantbeef> It unrolls into the equivalent human written code |
07:19:59 | FromDiscord | <scarf> oh, missed that `chain` was needed to execute it |
07:20:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc9 |
07:20:46 | FromDiscord | <Elegantbeef> Is having that syntax sugar really worth it, i dont know |
07:25:30 | FromDiscord | <scarf> love me some sugar |
07:25:53 | FromDiscord | <Elegantbeef> Well then use my package and complain about how it's likely broken or undocumented |
07:27:46 | FromDiscord | <scarf> anyways it was fun learning all these |
07:29:33 | * | kenran joined #nim |
07:33:20 | FromDiscord | <dizzyliam [they/them]> Can a proc be defined inside a proc call, for callbacks etc., or do you have to define it before hand then use its identifier? |
07:34:16 | FromDiscord | <Elegantbeef> A symbol cannot be used before it's declaration |
07:34:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gcc |
07:39:38 | * | PMunch joined #nim |
07:43:39 | FromDiscord | <dizzyliam [they/them]> sent a code paste, see https://play.nim-lang.org/#ix=4gce |
07:43:50 | FromDiscord | <Elegantbeef> Yes you can use anonymous procs |
07:44:43 | FromDiscord | <Require Support> if im using `createThread` and i don't really care what happens to the thread do I have to use `joinThread` ? |
07:45:48 | FromDiscord | <Require Support> (edit) "if im using `createThread` and i don't really care what happens to the thread do I have to use `joinThread` ? ... " added "aka my proc doesnt return anything" |
07:45:58 | FromDiscord | <dizzyliam [they/them]> In reply to @Elegantbeef "Yes you can use": Ah, a keyword I can search. Thanks :) |
07:48:20 | FromDiscord | <Elegantbeef> You do not need to do anything |
07:49:41 | PMunch | @Require_Support, if you create a thread and your program exits then the thread will get killed |
07:50:12 | PMunch | Even if it hasn't finished executing its procedure |
07:50:51 | * | kenran quit (Remote host closed the connection) |
07:56:50 | PMunch | dizzyliam_[they/them], typically you would call those closures |
07:56:59 | PMunch | Procedures created within another procedure |
07:57:35 | FromDiscord | <Require Support> In reply to @PMunch "@Require_Support, if you create": i guess im fine with that for now but thanks for the heads up ๐ |
07:59:18 | FromDiscord | <Elegantbeef> Pmunch you do not call those closures |
07:59:32 | FromDiscord | <Elegantbeef> Closures are only closures if they store an environment |
08:00:01 | PMunch | Sure, but every proc created within a proc in Nim store their environment |
08:00:10 | FromDiscord | <Elegantbeef> No they dont |
08:00:17 | PMunch | Don't they? |
08:00:34 | FromDiscord | <Elegantbeef> If you want to be pedantic, yes |
08:01:31 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4gco |
08:03:32 | PMunch | Indeed Nim seems to check if it actually needs to capture anything from the environment: https://play.nim-lang.org/#ix=4gcp |
08:03:58 | PMunch | This has interesting ramifications |
08:05:43 | FromDiscord | <scarf> that share to ix makes me wonder how come ix.io can handle all the bandwidth |
08:05:51 | FromDiscord | <scarf> (edit) "share" => "`share" | "ix" => "ix` button" |
08:06:38 | FromDiscord | <Rika> Itโs not a lot to serve text |
08:08:20 | PMunch | Yeah, text is pretty cheap |
08:09:51 | FromDiscord | <Elegantbeef> There arent many ramifications to be fair |
08:09:57 | FromDiscord | <Elegantbeef> Nimcall -\> closure is implicit |
08:10:41 | FromDiscord | <Elegantbeef> Of course you need to mark a anonymous procedure if you want it as a closure though |
08:10:57 | PMunch | Well I was considering a nice interface for Ratel interrupts |
08:16:56 | FromDiscord | <Elegantbeef> But now you're considering a bad interface? ๐ |
08:23:47 | PMunch | Haha, no I had discarded the idea of letting the user pass in a procedure because I thought they would end up as closures |
08:24:05 | FromDiscord | <Elegantbeef> you can take static procs |
08:24:12 | FromDiscord | <Elegantbeef> Can also take `proc(){.nimcall.}` |
08:26:16 | FromDiscord | <Elegantbeef> Static procs if you dont know directly call the procedure 0 indirection |
08:28:44 | * | jjido joined #nim |
08:34:29 | PMunch | static procs? |
08:35:01 | FromDiscord | <Rika> Compile time value procedures |
08:35:33 | FromDiscord | <Elegantbeef> Yea you can take a `p: static proc(){.nimcall.}` or what have you |
08:46:06 | * | dza quit (Quit: ) |
08:47:16 | * | dza joined #nim |
08:54:06 | PMunch | And those won't be `proc () {.compileTime.}`? |
08:57:28 | FromDiscord | <Elegantbeef> Nope |
08:57:38 | FromDiscord | <Elegantbeef> Those are nimcalls that are callable at runtime |
08:59:42 | FromDiscord | <Elegantbeef> I mentioned my remote refs on that thread forum post, https://github.com/beef331/nimtrest/blob/master/remoterefs.nim#L102 these behave like pointer procs but are typed to the procedure called |
09:00:02 | FromDiscord | <Elegantbeef> It's the same as a template that takes a proc and inserts a call |
09:01:13 | FromDiscord | <Elegantbeef> Inotherwords my remoterefs stuff enables custom allocators without any arena/context, uses Nim's RAII, and also can inline allocation calls ๐ |
09:13:29 | PMunch | Still not entirely sure what the difference between proc and static proc would be |
09:13:42 | FromDiscord | <Elegantbeef> pointer proc vs directly called |
09:13:48 | FromDiscord | <Elegantbeef> the latter is more likely to be inlined |
09:13:55 | PMunch | But what does directly called mean? |
09:14:39 | FromDiscord | <Elegantbeef> Like if instead of you taking a parameter you called the proc that the procedure called directly |
09:15:05 | FromDiscord | <Elegantbeef> It's just like if you had a template that took a `proc(){.nimcall.}` and passed the symbol of it to the procedure |
09:15:42 | PMunch | Aah right |
09:27:34 | FromDiscord | <graham_o> sent a long message, see http://ix.io/49IZ |
09:31:47 | FromDiscord | <haxscramper> PMunch: IIRC I asked about that recently but got no response -- are there any written community guidelines now, like the ones discussed in https://forum.nim-lang.org/t/8629 ? |
09:34:53 | PMunch | Nothing that's open. Apart from "don't be an asshole" |
09:35:15 | FromDiscord | <Elegantbeef> Yet somehow i persist |
09:35:31 | PMunch | Well, there are different levels of assholery |
09:36:18 | FromDiscord | <Elegantbeef> Shit i need to get my bingo card |
09:36:50 | FromDiscord | <haxscramper> You don't have any external written descriptions either? |
09:37:24 | FromDiscord | <haxscramper> "nothing that's open" -- anything that is closed? |
09:37:55 | FromDiscord | <Elegantbeef> > We are already working on putting together moderation guidelines for our moderators to ensure everyone is aligned and will be working together to make the Nim community a kind and welcoming place for everyone. |
09:38:03 | FromDiscord | <Elegantbeef> Seems like they have a checklist to keep people around ๐ |
09:41:40 | * | jmdaemon quit (Ping timeout: 260 seconds) |
09:43:26 | FromDiscord | <haxscramper> yeah, but it's been ~year since then so I'm wondering if there are any results |
09:47:14 | PMunch | We've discussed the matter of something like a CoC multiple times, but both the community and the moderation team have landed on not wanting one |
09:47:47 | PMunch | The moderation guidelines that were talked about in that post where internal guidelines for our moderators, and not something which was ever intended to be published |
09:48:56 | PMunch | We now have a sort of process for moderation, but nothing is chiselled in stone, but that is partially by design |
09:50:43 | PMunch | @haxscramper, does that answer your question? |
09:51:45 | FromDiscord | <haxscramper> Yyes, it does answer my question |
09:51:51 | FromDiscord | <haxscramper> (edit) "Yyes," => "Yes," |
09:52:40 | PMunch | We're always open to feedback on the issue of moderation as well. Either openly here, in private messages, or anonymously in our Google Form |
10:00:18 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
10:00:30 | FromDiscord | <haxscramper> Well, if there are no clear rules I don't understand how this works exactly, but whatever, the thread is pretty illustrative when it comes to determining the prevailing attitude |
10:00:55 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4gcU |
10:11:57 | FromDiscord | <MilesTheFox> How to use Clang instead of GCC? |
10:15:46 | FromDiscord | <ShalokShalom> --cc:gcc |
10:16:02 | FromDiscord | <ShalokShalom> In reply to @MilesTheFox "How to use Clang": https://nim-lang.org/docs/nimc.html#compiler-selection |
10:16:19 | FromDiscord | <ShalokShalom> (edit) "--cc:gcc" => "--cc:llvm" |
10:17:38 | FromDiscord | <ShalokShalom> (edit) "https://nim-lang.org/docs/nimc.html#compiler-selection" => "https://nim-lang.org/docs/nimc.html#compiler-usage" |
10:19:10 | FromDiscord | <MilesTheFox> I just realized that Clang is slow XD |
10:20:19 | FromDiscord | <EyeCon> In reply to @hmmm "broskis is there a": http://nim-lang.github.io/Nim/strutils.html#allCharsInSet%2Cstring%2Cset%5Bchar%5D (I don't know if anyone in the meantime referred to this, I'm too far back to read everything so far) |
10:20:28 | FromDiscord | <Yardanico> In reply to @ShalokShalom "--cc:llvm": --cc:clang |
10:20:29 | FromDiscord | <Yardanico> not llvm |
10:20:50 | FromDiscord | <Yardanico> In reply to @MilesTheFox "I just realized that": it's not really |
10:21:22 | FromDiscord | <MilesTheFox> With Clang it took 1 minute to compile my app XD |
10:21:31 | FromDiscord | <MilesTheFox> With GCC it took only 10 seconds |
10:21:51 | FromDiscord | <Yardanico> weird then |
10:21:53 | FromDiscord | <MilesTheFox> (I use 11 years old laptop) |
10:22:03 | FromDiscord | <ShalokShalom> In reply to @Yardanico "--cc:clang": Thanks. The docs dont say that |
10:22:08 | FromDiscord | <Yardanico> In reply to @MilesTheFox "(I use 11 years": do you have any gcc-specific options set? |
10:22:27 | FromDiscord | <fbpyr> for quick compiling feedback in inim I like using `tcc` |
10:22:56 | FromDiscord | <fbpyr> but have not used in on any larger project. |
10:23:12 | FromDiscord | <ShalokShalom> https://nim-lang.org/docs/nimc.html#compiler-selectionโตโตDo you know whatโต--cc:llvm_gcc does? |
10:23:19 | FromDiscord | <DarkSky> are there any Neovim plugins for Nim? |
10:23:21 | FromDiscord | <DarkSky> couldnt find any |
10:23:34 | FromDiscord | <Yardanico> :P https://media.discordapp.net/attachments/371759389889003532/1043109200491978752/image.png |
10:23:37 | FromDiscord | <Yardanico> https://github.com/alaviss/nim.nvim |
10:23:49 | FromDiscord | <ShalokShalom> The LSP one works for it as well, I guess |
10:23:59 | FromDiscord | <DarkSky> In reply to @Yardanico ":P": my blind ass could swear i havent seen that link before lol. thanks |
10:24:03 | FromDiscord | <Yardanico> In reply to @ShalokShalom "The LSP one works": nvim has better integration as it uses nimsuggest directly |
10:24:07 | FromDiscord | <ShalokShalom> NeoNim |
10:24:10 | FromDiscord | <Yardanico> "Semantic highlighting with nimsuggest. Highlight as you type (experimental)" |
10:24:13 | FromDiscord | <Yardanico> and this too |
10:24:19 | FromDiscord | <ShalokShalom> I see, super |
10:24:32 | FromDiscord | <ShalokShalom> The documentation around - - cc: seems lackluster |
10:24:43 | FromDiscord | <ShalokShalom> There are not really any of the options listed |
10:24:58 | FromDiscord | <ShalokShalom> I guess there is msvc and intel too? |
10:25:03 | FromDiscord | <ShalokShalom> How is their handle? |
10:25:18 | FromDiscord | <Yardanico> In reply to @ShalokShalom "https://nim-lang.org/docs/nimc.html#compiler-select": https://releases.llvm.org/2.8/docs/CommandGuide/html/llvmgcc.html |
10:25:23 | FromDiscord | <Yardanico> llvm frontend for gcc |
10:25:39 | FromDiscord | <Yardanico> In reply to @ShalokShalom "There are not really": yeah, a good first PR |
10:25:47 | FromDiscord | <Yardanico> list is in https://github.com/nim-lang/Nim/blob/devel/compiler/extccomp.nim |
10:28:21 | FromDiscord | <zidsal> if I pas an object (not ref) into a function as an argument will it always make a copy of that object? or does it only make a copy of I assign that to a variable inside the function? |
10:28:31 | FromDiscord | <Yardanico> In reply to @zidsal "if I pas an": it'll make a copy if the object is small enough |
10:28:39 | FromDiscord | <Jessa> sent a code paste, see https://paste.rs/H4I |
10:28:47 | FromDiscord | <Yardanico> currently the hard-coded limit is 24 bytes for pass-by-ref for objects |
10:29:02 | FromDiscord | <ShalokShalom> In reply to @Yardanico "yeah, a good first": Yeah, I thought about that. It wouldnt be my first, but a good one once I am home. ๐ |
10:29:14 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4gd1 |
10:29:20 | FromDiscord | <Yardanico> if you want to make a lookup table you should assign keys to actual procedures, not the types |
10:29:31 | FromDiscord | <Yardanico> and also `lookup: Table` is wrong since you're not specifying the whole type |
10:29:41 | FromDiscord | <Yardanico> either do Table[string, MyProcType] or just don't specify the type (for auto inference) |
10:30:13 | FromDiscord | <b1rdf00d> doesn't the nim compiler try to move variables, unless they are used again after the function call site? |
10:30:31 | FromDiscord | <albassort> In reply to @Jessa "can i get a": i think what you're looking for is a variable โตyou can use ``let`` ``const`` or ``var`` โต/s |
10:30:53 | FromDiscord | <Yardanico> In reply to @Jessa "can i get a": depends on where the string will come from |
10:31:09 | FromDiscord | <Jessa> In reply to @Yardanico "you're trying to assign": i seeโตโตwhy did the tutorial thingy i found use type then?โตi don't think i follow https://media.discordapp.net/attachments/371759389889003532/1043111113098788934/image.png |
10:31:38 | FromDiscord | <Yardanico> In reply to @Jessa "i see why": what tutorial is that? |
10:31:46 | FromDiscord | <Yardanico> ah you're looking at dynlib |
10:32:02 | FromDiscord | <Yardanico> In reply to @Jessa "i see why": If you check the whole code, you can see that it uses this type to cast the function pointer from the shared library into https://media.discordapp.net/attachments/371759389889003532/1043111332712562729/image.png |
10:32:06 | FromDiscord | <ShalokShalom> In reply to @Yardanico "llvm frontend for gcc": What's the point of a llvm frontend for gcc? |
10:32:07 | FromDiscord | <Yardanico> If you're using pure Nim you don't need that |
10:32:17 | FromDiscord | <Yardanico> In reply to @ShalokShalom "What's the point of": because clang didn't always exist |
10:32:24 | FromDiscord | <Yardanico> at first llvm actually wanted to integrate with gcc |
10:32:28 | FromDiscord | <ShalokShalom> Ah, I see |
10:32:33 | FromDiscord | <albassort> @Yardanico how do types which are just aliases eg ``type x = string`` work on the backend |
10:32:33 | FromDiscord | <ShalokShalom> I didn't even know thaz |
10:32:35 | FromDiscord | <Jessa> i am also using it to load DLL modulesโตโตthough, i wanted to use a lookup for easier access of the templates |
10:32:49 | FromDiscord | <Yardanico> In reply to @albassort "<@177365113899057152> how do types": wdym? they're literally just aliases |
10:32:58 | FromDiscord | <albassort> so then why do aliases have a limit |
10:33:02 | FromDiscord | <Yardanico> what limit? |
10:33:10 | FromDiscord | <albassort> i misunderstood you |
10:33:11 | FromDiscord | <albassort> nevermind |
10:33:30 | FromDiscord | <Yardanico> In reply to @Jessa "i am also using": well, one thing to note is that you can't store different values of different types in a table |
10:33:37 | FromDiscord | <albassort> i thought you meant you cant have an alias with type info larger than 24bytes |
10:33:39 | FromDiscord | <Yardanico> if your procedures have different signatures you'll have to do type erasure and save the type info elsewhere |
10:33:47 | FromDiscord | <Yardanico> In reply to @albassort "i thought you meant": that's about pass-by-copy or pass-by-ref for objects |
10:34:08 | FromDiscord | <albassort> yea i was like "oh so are these types more than just aliases in the backend" |
10:34:18 | FromDiscord | <zidsal> @Yardanico is there a benefit to forcing objects to copy if its less then 24 bytes? (ignoring any compiler limitations for a second) if the function doesn't mutate it in anyway wouldn't it be better to pass it by reference |
10:34:54 | FromDiscord | <Yardanico> In reply to @zidsal "<@177365113899057152> is there a": I'm not that good at compiler optimizations, but as I understand it's just more efficient than passing by pointer and then dereferencing it |
10:34:57 | FromDiscord | <Yardanico> for small objects |
10:35:05 | FromDiscord | <zidsal> huh til |
10:35:14 | FromDiscord | <Yardanico> since if you pass by reference, you have to dereference it |
10:36:48 | FromDiscord | <Yardanico> see e.g. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in |
10:39:50 | FromDiscord | <MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4gd4 |
10:40:01 | FromDiscord | <Yardanico> on windows? |
10:40:26 | FromDiscord | <MilesTheFox> https://media.discordapp.net/attachments/371759389889003532/1043113443152109578/image.png |
10:40:28 | FromDiscord | <Yardanico> also why `msse4.1 -msse4.2 -mmmx -mssse3 -msse -msse2 -mfxsr` specifically? I mean you can just specify those with march so you compile for a specific CPU microarch |
10:40:37 | FromDiscord | <Yardanico> and if you want to compile for your own CPU, just do `-march=native` |
10:40:45 | FromDiscord | <Yardanico> but still, clang being slow here is really weird, it is on par or faster for me usually |
10:40:49 | FromDiscord | <MilesTheFox> I'm doing that for modern CPUs |
10:40:49 | FromDiscord | <Yardanico> especially a 6x difference |
10:41:00 | FromDiscord | <MilesTheFox> In reply to @MilesTheFox "I'm doing that for": Also VM protection |
10:41:24 | FromDiscord | <Yardanico> In reply to @MilesTheFox "I'm doing that for": then use `x86-64-v3` ? |
10:41:31 | FromDiscord | <Yardanico> `-march=x86-64-v3` |
10:41:50 | FromDiscord | <MilesTheFox> In reply to @Yardanico "then use `x86-64-v3` ?": I still wanna test it (I use Intel Celeron B815) |
10:42:25 | FromDiscord | <Yardanico> okay, so you don't have any .nims or .cfg files with specific config options? and did you try multiple times? |
10:42:32 | FromDiscord | <Yardanico> because nim caches C object files |
10:42:40 | FromDiscord | <Yardanico> try `--forceBuild` for both gcc and clang |
10:42:44 | FromDiscord | <Yardanico> that's a nim compiler argument |
10:42:48 | FromDiscord | <MilesTheFox> I don't have any configs |
10:43:14 | FromDiscord | <MilesTheFox> In reply to @Yardanico "try `--forceBuild` for both": GCC is still faster |
10:43:22 | FromDiscord | <Yardanico> interesting |
10:43:27 | FromDiscord | <Yardanico> by much? |
10:43:32 | FromDiscord | <MilesTheFox> Yeah |
10:43:39 | FromDiscord | <Yardanico> really weird |
10:44:39 | FromDiscord | <MilesTheFox> It takes ~10-15 seconds to compile 2 C objects |
10:44:46 | FromDiscord | <MilesTheFox> On Clang |
10:44:52 | FromDiscord | <MilesTheFox> On GCC less than second |
10:45:22 | * | jjido joined #nim |
10:45:27 | FromDiscord | <Yardanico> that might be a clang bug, or some misconfiguration, I can't say anything more specific :P |
10:45:42 | FromDiscord | <MilesTheFox> Okayy |
10:46:16 | FromDiscord | <MilesTheFox> Also, I heard it's possible to embed executable inside Nim app |
10:46:31 | FromDiscord | <Yardanico> depends on what do you want to do with it, yers |
10:46:53 | FromDiscord | <Yardanico> you can embed it as a string, and then your main app executes you can write that executable to a file and execute it |
10:48:01 | FromDiscord | <MilesTheFox> I don't wanna write a file. |
10:48:07 | FromDiscord | <MilesTheFox> I don't wanna do any file operations |
10:48:38 | FromDiscord | <Yardanico> well that'll be much more complicated and is usually done by malware writers/researchers, there are a lot of those repos on github so maybe you'll find what you need |
10:49:39 | FromDiscord | <MilesTheFox> Even non-malware requires it because all AVs are helly annoying |
10:49:51 | FromDiscord | <Yardanico> i think by doing that you'll only alert AVs more |
10:49:56 | FromDiscord | <Yardanico> by embedding executables I mean |
10:50:01 | FromDiscord | <MilesTheFox> I remember app that just makes text file was marked as malware by at least 3 AVs |
10:50:22 | FromDiscord | <zidsal> getting your applications signed is the best way to stop that (in theory) Miles |
10:50:53 | FromDiscord | <MilesTheFox> In reply to @zidsal "getting your applications signed": I'm not gonna talk with them because I hate AVs |
10:50:59 | FromDiscord | <MilesTheFox> The only good AV is ClamAV |
10:51:12 | FromDiscord | <Phil> AFAIK getting a nim binary past AVs is a hard path to walk even if you don't select hard mode.โตYou're pretty much only left with getting arbitrarily assigned as trustworthy through stuff like signing |
10:51:13 | FromDiscord | <MilesTheFox> Open-source, stable, fast and no false-positives |
10:51:23 | FromDiscord | <Yardanico> > no false-positives |
10:51:25 | FromDiscord | <Yardanico> surely |
10:52:07 | FromDiscord | <MilesTheFox> In reply to @Isofruit "AFAIK getting a nim": I even unhooked ntdll |
10:52:33 | FromDiscord | <MilesTheFox> AVs use ntdll to scan malware in real-time (it also makes apps very slow) |
10:53:21 | FromDiscord | <MilesTheFox> And if they find any suspicious or weird behavior, they immediately terminate or suspend this process |
10:54:17 | FromDiscord | <MilesTheFox> For example some Chinese AVs will detect your app as malware if you use anything related to cryptography |
12:05:37 | * | pro joined #nim |
12:09:42 | FromDiscord | <qb> Anyone some better idea to calculate edges of a sequence of points? I don't like the current code: https://play.nim-lang.org/#ix=4gdq |
12:19:02 | PMunch | @qb you could use min and max to shorten the code |
12:19:22 | PMunch | By the way you have a bug with the bottom right pair |
12:20:35 | PMunch | This is the bounding code I have in SDLGamelib: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/collisions.nim#L98-L109 |
12:20:49 | PMunch | But that returns x/y and a width and height, so it's slightly different |
13:10:05 | FromDiscord | <qb> I see. I guess I could calculate top right and bottom left if I got top left and bottom right |
13:10:12 | FromDiscord | <qb> (edit) "I see. I guess I could calculate top right and bottom left if I got top left and bottom right ... " added "also" |
13:27:13 | PMunch | Oh yeah, you only need to find minX, minY, maxX, and maxY |
13:27:21 | * | rockcavera joined #nim |
13:27:46 | PMunch | So loop through all the points with `minX = min(minX, point.x)` kind of statements, and then after the loop generate the four coordinates |
13:32:40 | arkanoid | is there a Nim library to make agent based models? Otherwise I would just implement it |
13:34:25 | PMunch | Agent based models? |
13:51:30 | FromDiscord | <qb> In reply to @PMunch "So loop through all": Thanks. A lot sexier https://play.nim-lang.org/#ix=4gdK |
13:53:13 | FromDiscord | <voidwalker> How to preallocate a file with N bytes, fast ? I see there is no support for sparse files in nim libs? |
14:02:58 | * | rockcavera quit (Read error: Connection reset by peer) |
14:03:23 | * | rockcavera joined #nim |
14:03:23 | * | rockcavera quit (Changing host) |
14:03:23 | * | rockcavera joined #nim |
14:06:22 | FromDiscord | <Gumbercules> In reply to @voidwalker "How to preallocate a": If you can do it with C you can do it with Nim |
14:06:50 | FromDiscord | <voidwalker> I know, but if I wanted to do C, I'd not be here : P |
14:08:58 | FromDiscord | <Gumbercules> Well Nim compiles to C if you're running the command `nim c -r foo.nim` so you're already using C whether you like it or not |
14:09:16 | FromDiscord | <ratapenado> Hello, I remember a debate to know if Nim 2.0 would be case sensitive, what was decided at the end ? |
14:09:30 | FromDiscord | <Gumbercules> There's no `createSparseFile` function in the stdlib as far as I'm aware |
14:09:38 | FromDiscord | <voidwalker> I never looked at the C code, so from my point of view, I am only doing C code |
14:09:49 | FromDiscord | <voidwalker> (edit) "C" => "nim" |
14:10:17 | FromDiscord | <Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4gdS |
14:10:27 | FromDiscord | <Gumbercules> In reply to @voidwalker "I never looked at": well, that's certainly one way to look at things... |
14:10:31 | FromDiscord | <ratapenado> In reply to @PMunch "Agent based models?": It's a simulation model based on autonomous agents |
14:11:09 | FromDiscord | <ratapenado> In reply to @Gumbercules "well, that's certainly one": Well that's the point of programming in Nim, no? |
14:11:20 | FromDiscord | <Gumbercules> What's the point of programming in Nim? |
14:11:30 | FromDiscord | <Gumbercules> I'm confused by your question |
14:11:51 | FromDiscord | <Gumbercules> Not having to think about C? |
14:12:15 | FromDiscord | <Gumbercules> You'll be a much better Nim programmer (assuming you're targeting the C backend) if you know C well. |
14:12:22 | PMunch | @ratapenado, I believe (and certainly hope) that it won't be removed for Nim 2.0 |
14:12:48 | FromDiscord | <voidwalker> Too early to think about that. I first want to become a nim programmer. Becoming good is a later goal. |
14:13:25 | FromDiscord | <Gumbercules> That's fine - I didn't really mean to enter a conversation about C. I brought it up merely to demonstrate that you should be able to do what you're describing in Nim if you can accomplish the same in C. |
14:13:42 | FromDiscord | <Gumbercules> When I want to do something in Nim and I don't know how, I look for an example in C |
14:13:54 | FromDiscord | <Gumbercules> and then I replicate that in Nim using the stdlib or wrapping C by hand if I need to |
14:14:06 | FromDiscord | <Gumbercules> so for this example I simply googled "sparse file creation in C" |
14:14:18 | FromDiscord | <voidwalker> my goal now is to writite a minimally functional torrent client in the minimum number of LOC |
14:14:58 | FromDiscord | <voidwalker> So I can't wrap anything, gotta use what I have : ) |
14:15:34 | FromDiscord | <Gumbercules> Minimum lines of code in what language? |
14:15:45 | FromDiscord | <Gumbercules> because Nim is going to spit out C and then C is going to be compiled by your C compiler |
14:15:45 | FromDiscord | <voidwalker> in Nim |
14:15:53 | FromDiscord | <Gumbercules> so the number of lines of Nim is pretty asinine |
14:16:26 | FromDiscord | <voidwalker> Well most people will look at the Nim code, not the C code.. that's the whole point. C code is not very human readable anyway afaik |
14:16:36 | FromDiscord | <Gumbercules> C code is very human readable |
14:16:43 | FromDiscord | <voidwalker> The one that Nim generates? |
14:16:51 | FromDiscord | <Gumbercules> yes |
14:16:58 | FromDiscord | <Gumbercules> it might not be pleasant but it's' definitely readable |
14:17:29 | FromDiscord | <huantian> In reply to @Gumbercules "When I want to": Really? Iโve only done that when interacting with a C api, but Iโm general Iโd look to python |
14:17:55 | * | pro quit (Quit: pro) |
14:18:30 | FromDiscord | <Gumbercules> I guess it depends on your problem domain? I don't really use Python ever and am glad I don't have to |
14:18:39 | FromDiscord | <Gumbercules> if I was in scientific computing or something, the story would probably be different |
14:19:55 | FromDiscord | <huantian> But yeah void Iโd say itโs perfectly fine to not care about C when youโre learning Nim unless you actually need it |
14:20:18 | FromDiscord | <!!sharpcdf!!> This is coming out of nowhere, but I wonder if futhark can bind to lua |
14:21:44 | FromDiscord | <MagPhi> Which type system does nim have? |
14:22:14 | FromDiscord | <ringabout> In reply to @ratapenado "Hello, I remember a": The RFC was rejected. |
14:23:53 | FromDiscord | <ratapenado> @392962235737047041> @ringabout thanks for the answer |
14:24:58 | FromDiscord | <Gumbercules> In reply to @MagPhi "Which type system does": What do you mean? It's strongly and statically typed |
14:25:31 | FromDiscord | <Gumbercules> and it's a procedural and imperative language |
14:25:41 | FromDiscord | <MagPhi> In reply to @Gumbercules "What do you mean?": I asked what type system has been implemented in nim |
14:26:48 | FromDiscord | <Gumbercules> hopefully my answer was sufficient |
14:28:09 | PMunch | @MagPhi, but what do you mean by "what type system". It's not like the type systems have neatly defined names.. |
14:28:25 | PMunch | Nim also supports distinct types, which many other systems don't have. And it supports generics |
14:30:01 | * | arkurious joined #nim |
14:30:16 | FromDiscord | <MagPhi> In reply to @PMunch "<@695937684673134594>, but what do": yes they do |
14:30:21 | FromDiscord | <MagPhi> like Haskell has System F |
14:30:38 | FromDiscord | <MagPhi> (edit) "like Haskell ... has" added "and ML" |
14:31:31 | FromDiscord | <Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix= |
14:31:53 | FromDiscord | <MagPhi> why did you write the definition of System F? |
14:32:00 | FromDiscord | <Gumbercules> Because it's not a `type system` |
14:32:33 | FromDiscord | <Gumbercules> And Nim is not Haskell or ML or even close to either |
14:33:06 | FromDiscord | <Gumbercules> Nim does feature parametric polymorphism (as PMunch pointed out via the comment about supporting generics). |
14:35:16 | FromDiscord | <Gumbercules> If you're trying to compare Nim to languages slated for academia you're probably barking up the wrong tree |
14:36:06 | FromDiscord | <Gumbercules> and you'll probably leave feeling dissatisfied because that's not really a goal of Nim, to compete with those languages |
14:36:23 | * | derpydoo joined #nim |
14:38:37 | PMunch | To be honest you can get pretty far with that stuff in Nim though |
14:40:07 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
14:40:11 | FromDiscord | <Gumbercules> Yeah, I just haven't found too many people ditching Haskell or ML for Nim. |
14:40:41 | FromDiscord | <Gumbercules> https://sr.ht/~duangle/scopes/ maybe |
14:41:18 | FromDiscord | <Gumbercules> https://call-cc.org/ maybe |
14:42:39 | FromDiscord | <Gumbercules> https://nim-lang.org/docs/manual.html#types |
14:43:12 | FromDiscord | <Gumbercules> I guess would be the best rundown of Nim's type system |
14:44:35 | PMunch | Hmm, scopes looks interesting |
14:46:52 | FromDiscord | <Gumbercules> If you're really into type theory - https://www.idris-lang.org/ - has been doing quite a bit with dependent types |
14:47:03 | FromDiscord | <Gumbercules> I can't say much about the language other than that |
14:48:25 | FromDiscord | <Gumbercules> In reply to @PMunch "Hmm, scopes looks interesting": yeah the author is also quite interesting - cool person and fun to interact with |
14:49:15 | FromDiscord | <Gumbercules> building the scopes project can be quite the PITA |
14:49:24 | FromDiscord | <deech> Yeah, from what I can tell Nim's type system is more C++ templates than ML. |
14:53:06 | PMunch | It really annoys me, I found a language at some point. Small language, with macros support. But the way they did macros was by compiling in stages. So macros where compiled to machine code, run, and the output was then put back into the syntax tree and the compiler had another go at compiling. |
14:53:12 | PMunch | But I can't seem to find it again |
14:53:20 | PMunch | Maybe it was a dream I had :P |
14:56:33 | * | pro joined #nim |
14:57:28 | FromDiscord | <ShalokShalom> In reply to @MagPhi "like Haskell and ML": Nope |
14:57:48 | FromDiscord | <ShalokShalom> Haskell started with System F and they went back to HM |
14:57:59 | FromDiscord | <ShalokShalom> ML was always HM |
14:59:34 | FromDiscord | <jmgomez> In reply to @deech "Yeah, from what I": Which is not necessary a bad thing, is it? In the past I liked it to be rigid but in real life it's nice to have the flexibility to restricts the types as you see fit rather than hitting limitations or fighting the type system. Still the fact that templates are turing complete despite its noise and flaws doesnt cease to amaze me โตTim Sweeney has an interesting view on the whole thing https://twi |
14:59:34 | * | pro quit (Client Quit) |
14:59:46 | FromDiscord | <ShalokShalom> In reply to @PMunch "It really annoys me,": Was it hosted or compiled to machine code? |
15:03:53 | FromDiscord | <ShalokShalom> In reply to @jmgomez "Which is not necessary": His tweet two pieces above that is just showing that he is not writing much code himself anymore |
15:03:56 | FromDiscord | <ShalokShalom> https://mobile.twitter.com/TimSweeneyEpic/status/1213814236184485889 |
15:04:22 | FromDiscord | <deech> sent a long message, see https://paste.rs/y6B |
15:04:50 | FromDiscord | <deech> (edit) "https://paste.rs/l3X" => "http://ix.io/4gea" |
15:05:12 | FromDiscord | <ShalokShalom> How can you think, Rust is "a move forward and a move backwards" because it doesn't have your favorite feature x |
15:05:21 | FromDiscord | <deech> (edit) "sent" => "In reply to @jmgomez "Which is not necessary": My biggest practical issue with generics as macro expansion is that it's basically impossible to release libraries of higher order functions because they can make assumptions that aren't present in the type signature. Basically `id ::" | "long message, see http://ix.io/4gea" => "-> a` has infinite implementations. Type inference also suffers but who knows that might be a |
15:05:57 | FromDiscord | <deech> (edit) "signature. Basically" => "signature," |
15:06:15 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4geb |
15:06:17 | FromDiscord | <jmgomez> In reply to @deech "My biggest practical issue": I feel you, hopefully concepts (in both langs) will address it |
15:06:55 | FromDiscord | <ShalokShalom> And the safety guarantees are more worth than he gives them credit. |
15:07:23 | FromDiscord | <jmgomez> Well, he built one of the nicest piece of software of all time so at least he should be taken into consideration. That said, dont wanna start a debate between C++ and Rust here. But I can see adv and flaws in both |
15:10:09 | FromDiscord | <ShalokShalom> In reply to @Gumbercules "If you're trying to": I am happy with both F# and Nim and had my fair share of type system discussions with the Nim people already |
15:10:16 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i send a file as a response in jester? |
15:10:35 | FromDiscord | <deech> In reply to @jmgomez "I feel you, hopefully": I'm pretty skeptical, can't put that genie back in the bottle, the way forward if you really want that is to have a new "non-reflectable generic" construct where parametric polymorphism actually works again. But I don't think it is in Nim's best interests to pursue it either. |
15:10:56 | FromDiscord | <ShalokShalom> It seems, they don't see the benefits of an advanced type system, nor the benefit of advanced functional programming techniques in general. |
15:11:13 | FromDiscord | <ShalokShalom> I guess they assume, this goes against the imperative nature of the language |
15:12:11 | FromDiscord | <ShalokShalom> In reply to @jmgomez "Well, he built one": You mean the Unreal Engine?โตโตDoes he really contribute to it still, these days? |
15:12:43 | FromDiscord | <ShalokShalom> I assume, he doesnt really touch much code anymore, as most billionaire programmers. |
15:13:13 | FromDiscord | <jmgomez> In reply to @deech "I'm pretty skeptical, can't": What do you mean with non-reflectable. Concepts are already parametric polymorphism, arent they? |
15:15:07 | FromDiscord | <deech> In reply to @jmgomez "What do you mean": It's a set of constraints on the type but that doesn't stop anyone from doing a `when T is Blah: ...`, or `compiles(default(T).something)`.I suppose you can audit for that but at that point it's not really worth it. |
15:15:35 | FromDiscord | <jmgomez> Yes, Unreal. He did the bulk work on the early days, the difficult part. Now it's about to scale the team and to apply the latest technique. Most programmers are philosophers (see uncle bob and his gang), the guy actually did something big. Also he said once or two that he is working in Verse |
15:17:10 | FromDiscord | <pointystick> sent a code paste, see https://play.nim-lang.org/#ix=4gee |
15:17:35 | FromDiscord | <ShalokShalom> I dont doubt his earlier contributions |
15:19:01 | FromDiscord | <ShalokShalom> But I doubt he has done serious work in Rust |
15:19:18 | FromDiscord | <ShalokShalom> And lead projects across years |
15:29:27 | FromDiscord | <deech> I wrote up a small comment on Reddit about where I currently see Nim's strengths and weaknesses: https://old.reddit.com/r/nim/comments/yx0508/how_come_nim_is_not_a_mess/iwume3m/ |
15:33:51 | FromDiscord | <jmgomez> Mostly agree. Maybe I would highlight ORC and the performance as wellโตOne thing that works pretty bad is async but yeah tooling + inference are my major complains ATM (and oc, the bugs) |
15:38:28 | FromDiscord | <auxym> threading also seems to be sort of a mess atm. |
15:44:23 | FromDiscord | <deech> IMO one of the biggest strengths of arc/orc isn't performance but making it easy to interop _with_ Nim from another language. I get basic linear types that tell me who owns the arguments being passed in and I don't have to set up and tear down some GC when making my FFI interface. It combined with Nim's C/C++ interop is why I chose it over other languages, I looked at D quite a bit but it doesn't have arc/orc, neither does Zig. |
15:46:13 | FromDiscord | <Gumbercules> In reply to @ShalokShalom "I am happy with": yeah I think there is plenty of room for both types of languages, they're not in any sort of competition in my mind |
15:47:07 | FromDiscord | <Gumbercules> In reply to @deech "IMO one of the": yes but if you want to call Nim from C for instance you still need to use cstring etc... correct? |
15:48:21 | FromDiscord | <Gumbercules> my project is built using a plugin architecture and I provide a bunch of APIs which are all using the `cdecl` calling convention to enable calling into them from any language that can compile to a shared library and call into C code |
15:48:31 | FromDiscord | <deech> In reply to @Gumbercules "yes but if you": Yes but if the argument is a `sink cstring` and `=copy` is `{.error.}` I know that the Nim side will own it. |
15:50:45 | FromDiscord | <jmgomez> In reply to @Gumbercules "my project is built": what are you building? In NimForUE I took advantage of the unreal reflection system, they have a limited form cdecl calling convention but it's pretty flexible. You can use pretty much the whole unreal api through it.. I feel like the same concept can be applied to do interop with other langs that owns a reflection system where you can push funcs (i.e. Net, Java, go?) etc. |
15:51:26 | FromDiscord | <deech> In reply to @jmgomez "what are you building?": Currently stealth, but I'll open source it when it's ready for viewing. ๐ |
16:06:28 | PMunch | @ShalokShalom, compiled |
16:07:35 | FromDiscord | <@thatrandomperson5-6310e3b26da03> I donโt need to download the files, i just need to serve the filesโต(@pointystick) |
16:08:11 | FromDiscord | <@thatrandomperson5-6310e3b26da03> There is also apperntly an issue wih that https://forum.nim-lang.org/t/2596 |
16:10:20 | PMunch | @thatrandomperson5-6310e3b26da03, that's a six year old issue, wouldn't be surprised if that was fixed by now |
17:10:36 | NimEventer | New thread by matthesoundman: Install issue from choosenim [Windows], see https://forum.nim-lang.org/t/9632 |
17:25:35 | * | PMunch quit (Quit: leaving) |
17:31:19 | * | jjido joined #nim |
17:34:57 | * | pro joined #nim |
17:35:32 | * | pro left #nim (#nim) |
17:41:43 | FromDiscord | <Jessa> is there a way to make a proc for all sequences?โตโตas i can't do `proc thing(sequence:seq): return type =` as `seq` needs a type, and i don't want to make an overload function for every type |
17:43:33 | FromDiscord | <Yardanico> In reply to @Jessa "is there a way": that will actually work, it's an implicit generic |
17:43:36 | FromDiscord | <Yardanico> but you can do explicit generics |
17:43:47 | FromDiscord | <Yardanico> `proc thing[T](myseq: seq[T]): T = stuff` |
17:44:03 | FromDiscord | <Jessa> In reply to @Yardanico "that will actually work,": it doesn't compile |
17:44:37 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4geK |
17:49:51 | FromDiscord | <EyeCon> In reply to @Jessa "it doesn't compile": `for x in seq` โ `for x in sequence` as `seq` is the type and `sequence` is the variable |
17:50:05 | FromDiscord | <Jessa> oh |
17:50:07 | FromDiscord | <Jessa> oh my god |
17:50:11 | FromDiscord | <Jessa> I'm an idiot |
17:50:38 | FromDiscord | <EyeCon> Not at all, happens to everyone |
17:50:58 | FromDiscord | <Jessa> this just shows that 7 years of coding doesn't relief you from these problems |
17:53:08 | deadmarshal | How can i make a sequence using ..? It says it's a slice, but I want a seq[int]. var s:seq[int] = @[1..n] |
17:54:30 | FromDiscord | <Phil> In reply to @deadmarshal "How can i make": Tried `{1..10}.toSeq`? |
17:54:47 | FromDiscord | <Phil> You wanted a sequence of a range right? |
17:56:35 | deadmarshal | Let me send the whole code, I'm not sure what is appropriate here: https://paste.c-net.org/CleggPerfect |
17:57:44 | FromDiscord | <Phil> In reply to @deadmarshal "Let me send the": So what you want to do is take a list of values and get how many of them are "cute", correct? |
17:58:12 | FromDiscord | <Phil> and `n` is the number of elements in the list? |
17:59:07 | deadmarshal | No, n is the highest element, the list should be from 1 to n. I want to get all permutations of that list, and see if each one is cute and count the cute ones. |
17:59:54 | deadmarshal | for example if n = 5, list would be @[1,2,3,4,5] |
18:00:03 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=4geN |
18:01:03 | FromDiscord | <Phil> In reply to @deadmarshal "for example if n": By "all permutations" you mean you want to get all lists with the values from 1 to 5?โตSoโต@[1,2,3,4,5], @[1,2,3,5,4] , @[1,2,5,3,4] etc.? |
18:02:18 | FromDiscord | <EyeCon> In reply to @deadmarshal "Let me send the": Note that you are not checking the unpermuted seq |
18:02:56 | deadmarshal | Yes u are right about permutations |
18:03:16 | FromDiscord | <Phil> Okay, that means so far your algo is lacking a piece that generates all possible permutations of @[1,2,3,4,5] |
18:03:17 | deadmarshal | Eyecon: oh you are right |
18:03:31 | FromDiscord | <Phil> Since so far you're only generating that one in order of the range |
18:03:58 | deadmarshal | Phil: Doesn't that nextPermutation give me all permutations? :D |
18:04:11 | FromDiscord | <Phil> Good question, let me check that proc, never used it |
18:04:18 | FromDiscord | <EyeCon> Somewhat cleaned-up version: https://play.nim-lang.org/#ix=4geR |
18:04:34 | FromDiscord | <EyeCon> In reply to @deadmarshal "<@180601887916163073>: Doesn't that nextPermutation": It does, provided that you start with a sorted seq |
18:04:58 | FromDiscord | <Phil> Which he would given that he's instantiating from a range |
18:05:03 | FromDiscord | <EyeCon> Yes |
18:05:39 | deadmarshal | Thank you that works. |
18:05:57 | deadmarshal | What is the difference of using () and {} before toSeq? |
18:06:42 | FromDiscord | <Phil> They should actually do the same in my eyes, toSeq(range) is just more normal syntax |
18:07:26 | deadmarshal | Perhaps that isCute function can be done with any too :D |
18:07:27 | FromDiscord | <Phil> Or rather if you use the same method call syntax they both look like this:โต`toSeq(1..10)` vs `(toSeq({1..10})` |
18:07:41 | FromDiscord | <Phil> (edit) "`(toSeq({1..10})`" => "`toSeq({1..10})`" |
18:07:41 | deadmarshal | i mean "any" function |
18:07:58 | FromDiscord | <Phil> You wanted to get the number of cute permutations right? |
18:08:04 | FromDiscord | <Phil> Or did you want to check if any of the permutations are cute? |
18:08:06 | deadmarshal | Yep |
18:08:22 | FromDiscord | <Phil> In that case "any" won't help you as that'll stop after finding the first cute permutation |
18:08:27 | deadmarshal | the number |
18:09:15 | FromDiscord | <Phil> Your approach may likely be the best one you can do.โตRight now you only have 1 seq and change that, you don't have a seq of all permutations at once |
18:09:18 | deadmarshal | No i mean using any on each element, instead of the for loop in iscute func |
18:10:00 | FromDiscord | <Phil> does `element` refer to each individual seq that represents a permutation fo the original one? |
18:10:02 | FromDiscord | <EyeCon> `proc isCute(s: seq[int]): bool = not (1..s.len).anyIt(it mod s[it-1] != 0 or s[it-1] mod it != 0)` I guess |
18:10:04 | deadmarshal | Yes, that is probably the reason for nextPermutation and not Permutations |
18:10:29 | deadmarshal | by element i meant an int |
18:10:30 | FromDiscord | <Phil> Ohhh you were in the loop in "isCute" |
18:10:45 | deadmarshal | yep EyeCon is right |
18:10:57 | FromDiscord | <Phil> I was mentally in the while loop that uses the isCute function |
18:11:06 | FromDiscord | <Phil> And I was like "how does any help you there in any capacity?" |
18:11:22 | FromDiscord | <Phil> God damn my brain is just so damn tired |
18:11:45 | deadmarshal | np, thanks y'all |
18:12:50 | FromDiscord | <EyeCon> https://play.nim-lang.org/#ix=4geU |
18:13:58 | deadmarshal | awesome |
18:40:50 | FromDiscord | <Gumbercules> In reply to @jmgomez "what are you building?": this is how I hot reload my game code and expose a lot of my engine's APIs to game code |
18:41:10 | FromDiscord | <Gumbercules> plugins (including game code) get compiled to a shared library and loaded / reloaded at runtime |
18:49:06 | FromDiscord | <jmgomez> In reply to @Gumbercules "this is how I": you mean with cdecl? โตWe also use a dynamic library, one hook into unreal and then one for the plugin and one for the game (so it compiles faster). The system is built in a way that compilation times scale horizontally |
18:49:38 | FromDiscord | <jmgomez> (edit) removed "a" | "library," => "libraries," |
18:50:25 | FromDiscord | <Gumbercules> well the `cdecl` calling convention just allows for any code that can compile to a shared library and expose functions with that calling convention, to hook into my engine |
18:50:52 | FromDiscord | <Gumbercules> so if you wrote your game code in Rust and it exposed functions with that calling convetion - you could use your Rust code with my engine |
18:56:19 | FromDiscord | <jmgomez> yeah, I know. I wasnt sure of what you were referring to. I guess you built a system on top of it |
18:57:49 | FromDiscord | <jmgomez> The first library that I mentioned above also uses it to communicate with UE for low level stuff. But most of it is know embed into the others |
18:58:42 | FromDiscord | <jmgomez> We pass some info between the libraries also with it |
18:58:43 | FromDiscord | <ShalokShalom> In reply to @jmgomez "Mostly agree. Maybe I": Inference? Type inference you mean? |
18:58:54 | FromDiscord | <jmgomez> yup |
19:00:14 | FromDiscord | <Gumbercules> Yeah I saw the work you and geek had been doing on UE5 stuff @jmgomez - very cool stuff! |
19:00:43 | * | jmdaemon joined #nim |
19:00:48 | FromDiscord | <Gumbercules> I'm not a fan of these big engines so I haven't used it but what you guys have done is impressive for sure! |
19:02:09 | FromDiscord | <jmgomez> Thank you! we have been pushing it hard for a decent amount of time and it's about to be usable soon ๐ |
19:02:40 | FromDiscord | <ShalokShalom> I am a big sucker for type inference |
19:03:00 | FromDiscord | <ShalokShalom> Nim has a type system, that does make type inference very hard |
19:03:12 | FromDiscord | <ShalokShalom> To the degree I am used to. |
19:04:20 | FromDiscord | <jmgomez> yeah, I like it too. And formal stuff. But what I appreciate from Nim is practicality |
19:04:34 | FromDiscord | <xixixi> is there documentation grouped by the type of the proc first parameter? |
19:04:52 | FromDiscord | <xixixi> as in all available operations on strings, seqs, etc? |
19:07:37 | FromDiscord | <jmgomez> I dont think there is |
19:18:15 | FromDiscord | <ShalokShalom> I dont think, anything can really be changed about it.โตโตAnd I had Araq coming down on me, for suggesting that proc's and func's could be inferred too |
19:18:29 | FromDiscord | <ShalokShalom> He made a very clear statement, that this is not going to happen |
19:18:44 | FromDiscord | <ShalokShalom> Some curse word and 'lazy' was part of the content. |
19:19:13 | FromDiscord | <jmgomez> hmm probably due to some design decision I guess |
19:19:21 | FromDiscord | <ShalokShalom> In reply to @jmgomez "yeah, I like it": Yes, its a very straight forward language |
19:19:26 | FromDiscord | <ShalokShalom> Unless, it isnt |
19:19:42 | FromDiscord | <ShalokShalom> In reply to @jmgomez "hmm probably due to": I understand it, when its for top level definitions |
19:20:09 | FromDiscord | <ShalokShalom> Even F# recommends it for those, and there is no language that uses type inference so widely. |
19:20:21 | FromDiscord | <ShalokShalom> It makes total sense, to enforce them there |
19:20:35 | FromDiscord | <ShalokShalom> But even that could do the editor for you |
19:20:42 | FromDiscord | <ShalokShalom> Based on the type inference of Nim |
19:21:07 | FromDiscord | <ShalokShalom> Idk about the complexity of a type inference system for a language like Nim |
19:21:37 | FromDiscord | <ShalokShalom> But for a functional language is Nims type system strictly not suitable, for complete inference |
19:22:07 | FromDiscord | <ShalokShalom> And as I had been told, is Nims type system more.. Well lets say patched together |
19:23:37 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4gfg |
19:23:59 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
19:25:06 | FromDiscord | <jmgomez> I dont know, It could be better but there are more important things to fix. Like bugs with generics, IC, etc. If it's doable I guess it can be improved at some point |
19:28:01 | FromDiscord | <ShalokShalom> Sure, you could improve it |
19:28:24 | FromDiscord | <ShalokShalom> But for type inference, you dont need to figure out only the proc or func at hand |
19:28:33 | FromDiscord | <ShalokShalom> It flows through your whole code |
19:28:45 | FromDiscord | <ShalokShalom> And I have seen other languages struggle with that |
19:28:52 | FromDiscord | <ShalokShalom> Namely Haskell, Scala, F# |
19:29:05 | FromDiscord | <ShalokShalom> And they all have a vastly superior type system |
19:29:27 | FromDiscord | <ShalokShalom> It might be, that Nims structures are that much easier to infer |
19:29:30 | FromDiscord | <ShalokShalom> But I doubt it. |
19:33:55 | FromDiscord | <jmgomez> my point is that IMO it shouldnt be a priority even if I like it.. although my opinion doesnt really matter ๐ |
19:48:07 | FromDiscord | <guttural666> style question: do you people group all the type definitions in a file at the top? until now I tended to declare everything as close to first use as possible |
19:48:29 | FromDiscord | <ShalokShalom> Yes |
19:49:03 | FromDiscord | <guttural666> kind of "litters" the file though, if you're searching for a type specifically, may be easier to go the more old school way of declaring on top I suppose |
19:49:07 | FromDiscord | <guttural666> okay |
19:49:45 | FromDiscord | <guttural666> I just think it's super convenient to see a type that you need for a proc right above it without having to jump/split screen etc. |
19:49:56 | FromDiscord | <guttural666> think I'm gonna stick to that |
19:54:14 | FromDiscord | <ShalokShalom> Well, sometimes you create complex types |
19:54:21 | FromDiscord | <ShalokShalom> Who all work into each other |
19:54:32 | FromDiscord | <ShalokShalom> And then you form the basement of your app on it |
19:54:43 | FromDiscord | <ShalokShalom> I think it makes sense to put them at the top |
19:55:05 | FromDiscord | <ShalokShalom> And then, when needed, create some smaller, more specific type definitons, where you need them |
19:56:08 | FromDiscord | <ShalokShalom> Like you can see in this example:โตโตhttps://github.com/thedevaspect/aspect-fsharp/blob/master/Game.fs |
19:57:08 | FromDiscord | <ShalokShalom> The main types at the top and then a few one down the line. |
19:58:40 | FromDiscord | <guttural666> "the basement of your app" ๐ that's a new one |
19:58:45 | FromDiscord | <guttural666> yeah, does make sense |
20:04:23 | FromDiscord | <ShalokShalom> Oh, sorry. ๐
|
20:04:42 | FromDiscord | <ShalokShalom> My broken English. The basis ofc |
20:05:44 | FromDiscord | <guttural666> I study broken English, being employed in German industry hahaha |
20:07:40 | FromDiscord | <ShalokShalom> Haha. I am German, at least theoretically |
20:08:01 | FromDiscord | <ShalokShalom> Born in Austria, and currently living in Germany half the time. |
20:08:12 | FromDiscord | <guttural666> I remember ๐ |
20:12:39 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
20:13:06 | FromDiscord | <Tuatarian> if I have a object variant/variant adt/whatever it's called |
20:13:11 | FromDiscord | <Tuatarian> and I change the discriminator |
20:13:25 | FromDiscord | <Tuatarian> do things associated to the variant it previously was get dealloced? |
20:16:40 | FromDiscord | <Tuatarian> ok it seems it's not relevant since objects can't dynamically change their branch |
20:16:58 | FromDiscord | <Tuatarian> so the entire previous thing will be freed when we run out of scope |
20:20:17 | FromDiscord | <Tuatarian> i phrased the above thing badly, the variable itself needs to be reassigned completely and can't switch branches without a reassignment |
20:20:22 | FromDiscord | <Tuatarian> so this is not a concern |
21:12:54 | * | derpydoo quit (Ping timeout: 256 seconds) |
21:22:12 | FromDiscord | <Elegantbeef> An alias can be done `type MyArray = array[10, int]` |
21:27:14 | FromDiscord | <Tuatarian> why is this failing to compile? |
21:27:23 | FromDiscord | <Tuatarian> gives error |
21:27:25 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfH |
21:27:57 | FromDiscord | <Tuatarian> https://play.nim-lang.org/#ix=4gfG |
21:27:59 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfI |
21:29:33 | FromDiscord | <Elegantbeef> `when b is int` |
21:30:37 | FromDiscord | <Tuatarian> why does if not work? |
21:30:41 | * | Phytolizer joined #nim |
21:30:45 | FromDiscord | <Elegantbeef> If is runtime |
21:31:05 | FromDiscord | <Tuatarian> oh and the return type must be known at comptime |
21:31:06 | FromDiscord | <Tuatarian> right |
21:31:18 | FromDiscord | <Tuatarian> even if it's untyped, the expr should have a type at comptime |
21:31:19 | FromDiscord | <Tuatarian> right? |
21:31:38 | FromDiscord | <Elegantbeef> Each branch of an if expression has to be typed the same |
21:32:05 | FromDiscord | <Elegantbeef> in this case you have `ival: float` |
21:32:16 | FromDiscord | <Elegantbeef> \and also all branches have to compile |
21:32:34 | FromDiscord | <Elegantbeef> when only compiles true branches |
21:32:37 | FromDiscord | <Elegantbeef> if compiles all branches |
21:33:12 | FromDiscord | <Tuatarian> oh i see |
21:33:33 | FromDiscord | <Tuatarian> so it would compile an invalid expression there in the top line if b is float |
21:33:39 | FromDiscord | <Tuatarian> but why did ints work? |
21:33:47 | FromDiscord | <Tuatarian> if I put an int there instead of a float, that worked fine |
21:33:57 | FromDiscord | <Elegantbeef> It doesnt work fine |
21:34:10 | FromDiscord | <Elegantbeef> `echo makenum(int(3))` |
21:34:21 | FromDiscord | <Elegantbeef> `3` is a untyped literal |
21:34:36 | FromDiscord | <Elegantbeef> it can be converted to any numeric type |
21:34:49 | FromDiscord | <Tuatarian> is `3` not an int literal? |
21:34:54 | FromDiscord | <Elegantbeef> Nope |
21:34:58 | FromDiscord | <Tuatarian> oh I see |
21:35:01 | FromDiscord | <Elegantbeef> It's an untyped literal |
21:35:08 | FromDiscord | <Tuatarian> and it gets converted as needed |
21:35:24 | FromDiscord | <juan_carlos> Is better to use `string.toOpenAray(a, b)` for `string[a .. b]` ?, do I must use `experimental:views` ?, or it just works now? |
21:35:57 | FromDiscord | <Elegantbeef> `toOpenArray` has always worked in place of `[a..b]` for passing to `openArray` |
21:35:59 | FromDiscord | <Elegantbeef> You cannot hold onto it |
21:36:05 | FromDiscord | <.tochka> it works without experimental if you dont save them to objects |
21:36:06 | FromDiscord | <Elegantbeef> you need views to hold onto it |
21:38:22 | FromDiscord | <Tuatarian> now I'm getting another odd issue |
21:38:24 | FromDiscord | <Tuatarian> ` if a.isInt: return makenum(-a.iVal)` |
21:38:27 | FromDiscord | <Tuatarian> doesn't compile |
21:38:37 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix= |
21:39:14 | FromDiscord | <Tuatarian> really no idea why this would be happening, there's nothing too weird here |
21:40:10 | FromDiscord | <Elegantbeef> the other branch likely has an expression |
21:40:59 | FromDiscord | <Tuatarian> full function is |
21:41:12 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfM |
21:43:37 | FromDiscord | <Tuatarian> that's the whole function |
21:43:49 | FromDiscord | <Tuatarian> oh this should be a when |
21:44:20 | FromDiscord | <Tuatarian> no, if I change it to when it says it cannot evaluate it at comptime |
21:46:36 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gfO |
21:47:15 | FromDiscord | <voidwalker> If I change import to include bencode and have the .nim file in the dir, it gives the right (first) result again |
21:54:46 | FromDiscord | <voidwalker> deleted the bencode.nim from the folder, now it says it cannot open `path_to_project/bencode.nim [IOError]` |
21:55:25 | FromDiscord | <voidwalker> why does it look for it there, if I have import ? :\ |
21:57:10 | * | Phytolizer quit (Quit: Client closed) |
22:03:58 | FromDiscord | <voidwalker> i fixed the later problem, starting/closing vscodium a few times. Still what's with the two different outputs for the same code ? |
22:07:17 | FromDiscord | <Tuatarian> In reply to @Elegantbeef "the other branch likely": tbh lmao I still have no idea what was causing that |
22:07:27 | FromDiscord | <Tuatarian> haven't fixed it yet, guess I'll just work around it for the time being |
22:08:49 | FromDiscord | <Tuatarian> rewriting the to remove the else branch and not use makenum causes the same error |
22:10:18 | FromDiscord | <Tuatarian> issue I think is that compiler can't verify that `a.iVal` is a legal call |
22:11:03 | FromDiscord | <Tuatarian> since only one of the object variants has an `iVal` field, general `HvNum` doesn't have it (obviously) |
22:11:19 | FromDiscord | <Tuatarian> I feel like there should be a reasonable way to do this though |
22:13:36 | FromDiscord | <dizzyliam [they/them]> Can procs from `system/nimscript` be used inside a macro? |
22:15:21 | FromDiscord | <Tuatarian> this kinda feels like a bad implementation of obj variants ngl |
22:15:29 | FromDiscord | <Tuatarian> there has to be a good way to do the thing I'm trying to do above |
22:15:39 | FromDiscord | <Tuatarian> but it's not clear at all and idk where to find proper docs/info regarding this kind of thing |
22:16:58 | FromDiscord | <guttural666> any way to make the element mutable in a for loop? https://media.discordapp.net/attachments/371759389889003532/1043288732826083388/image.png |
22:18:59 | FromDiscord | <Generic> use the mitems iterator |
22:23:55 | FromDiscord | <guttural666> can you help me out, how would I invoke that iterator? |
22:26:10 | FromDiscord | <dizzyliam [they/them]> `for counter in flag_set_counter.mitems:` |
22:28:09 | FromDiscord | <guttural666> yeah, just read it, thanks! |
22:28:27 | FromDiscord | <guttural666> and without the .mitems that would default to the immutable iterator |
22:28:34 | FromDiscord | <guttural666> read only |
22:29:16 | FromDiscord | <xixixi> oh god.. nobody asked for it, it's useful maybe once in a while, but parsecsv unconditionally skips empty lines. ans now I have to write my own csv parser ๐ฆ |
22:29:36 | FromDiscord | <xixixi> (edit) "ans" => "and" |
22:29:45 | FromDiscord | <guttural666> do you ppl omit the () in a call like that? think it's too easily confused with a field access |
22:30:03 | FromDiscord | <dizzyliam [they/them]> it's a readability thing for me |
22:30:03 | FromDiscord | <Tuatarian> I do much of the time |
22:30:20 | FromDiscord | <Tuatarian> usually the name is enough to tell you what the function does |
22:30:33 | FromDiscord | <guttural666> yeah probably true |
22:30:34 | FromDiscord | <Tuatarian> and you'll know whether it's a field access or call from that |
22:31:17 | FromDiscord | <guttural666> think I prefer to always use () for function calls tho |
22:31:41 | FromDiscord | <guttural666> don't have to think as much then |
22:31:49 | FromDiscord | <dizzyliam [they/them]> I definitely omit the () when the call should behave like field access. As in, all it does is retrieve information from the object it's being called on |
22:32:08 | FromDiscord | <guttural666> yeah yeah, that does make sense |
22:32:32 | FromDiscord | <dizzyliam [they/them]> a pseudo-field :) |
22:32:45 | FromDiscord | <guttural666> don't get me started about getters |
22:32:55 | FromDiscord | <Tuatarian> I do this too, I also used to abuse `.` notation but I've reigned myself in a little bit |
22:33:25 | FromDiscord | <guttural666> what would you consider abusing .? |
22:34:25 | FromDiscord | <guttural666> i tend to stick to the thing.do_smth_with_the_thing(you'll need this) notation, quite like that |
22:35:43 | FromDiscord | <guttural666> though echo "pls" is just so nice |
22:38:45 | FromDiscord | <dizzyliam [they/them]> That calling convention can combine with well chosen identifiers to make things read like english instructions, which is nice |
22:38:51 | FromDiscord | <dizzyliam [they/them]> `serve app` |
22:38:58 | FromDiscord | <dizzyliam [they/them]> `exec command` |
22:38:59 | FromDiscord | <guttural666> yeah, that's really neat |
22:39:00 | FromDiscord | <dizzyliam [they/them]> etc |
22:39:36 | FromDiscord | <guttural666> bit foreign at first, coming from c-style languages |
22:40:16 | FromDiscord | <guttural666> i'm still a bit all over the place with my function calls, not really decided on what's best |
22:44:14 | FromDiscord | <Tuatarian> In reply to @guttural666 "what would you consider": I once wrote `60.SetTargetFps` without thinking |
22:44:26 | FromDiscord | <Tuatarian> and then someone pointed it out to me |
22:44:29 | FromDiscord | <Tuatarian> and I was like yeah |
22:44:30 | FromDiscord | <.tochka> hm, how to have nim object definition that is compatible with c struct one? |
22:44:46 | FromDiscord | <Generic> {.pure.} |
22:44:52 | FromDiscord | <Generic> I think |
22:46:13 | FromDiscord | <Elegantbeef> Yea that strips the type information |
22:47:13 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gfZ |
22:47:47 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gg0 |
22:49:10 | FromDiscord | <voidwalker> the first one is the proper result, which I still get in my main program where I first tried to debug another problem, if I use include or import. However, in a new source file, the behaviour above happens. I tried on a distinct computer from terminal, and still the same. |
22:49:19 | FromDiscord | <.tochka> so, c2nim doesnt generate c compatible typedefs |
22:49:31 | FromDiscord | <DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4gg1 |
22:49:43 | FromDiscord | <DarkSky> (edit) "https://play.nim-lang.org/#ix=4gg1" => "https://play.nim-lang.org/#ix=4gg2" |
22:49:50 | FromDiscord | <Elegantbeef> `for x in 0..10:` |
22:49:58 | FromDiscord | <DarkSky> thxx |
22:50:21 | FromDiscord | <.tochka> In reply to @DarkSky "whats the equivalent of": for i in 0..9: echo "hello world" |
22:50:22 | FromDiscord | <guttural666> In reply to @Elegantbeef "`for x in 0..10:`": one question even a pleb like me could have answered, but Elegant is too fast on the trigger |
22:51:08 | FromDiscord | <Elegantbeef> Tochka `type A = object` doesnt have type information |
22:51:37 | FromDiscord | <Elegantbeef> Or atleast it shouldnt |
22:52:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg3 |
22:52:21 | FromDiscord | <Elegantbeef> Only inheritance types have type information |
22:52:31 | FromDiscord | <.tochka> i was talking about binary compatibility |
22:52:54 | FromDiscord | <Elegantbeef> Nim objects are binary compatible with C structs |
22:53:15 | FromDiscord | <.tochka> so, ordering of fields matter? |
22:53:44 | FromDiscord | <.tochka> no alignment optimizing ๐ |
22:54:06 | FromDiscord | <.tochka> ye i guess issue was that enums that were spitted by c2nim weren't sizeof cint |
22:54:09 | FromDiscord | <dizzyliam [they/them]> In reply to @.tochka "for i in 0..9:": Or slightly more readable IMO `for i in 0..<10` |
22:54:36 | FromDiscord | <Elegantbeef> `{.packed.}` if you want it packed |
22:54:39 | FromDiscord | <Elegantbeef> `{.align` if you want to handle that |
22:54:41 | FromDiscord | <Elegantbeef> It's actually nice that it doesnt do optimisations ime when dealing with opengl and the like |
22:55:40 | FromDiscord | <.tochka> i kinda prefer zig way, where you can add packed and export modifiers, but by default reordering is allowed |
22:57:23 | FromDiscord | <Elegantbeef> Yea it'd be nice to have the compiler to reorder it the best |
22:57:49 | FromDiscord | <Elegantbeef> I suppose a macro could do that, but i dont know the alignment rules so cannot say much |
22:58:12 | FromDiscord | <Elegantbeef> I was meaning on making a macro to reorder to 16bytes for opengl |
22:58:25 | FromDiscord | <.tochka> probably side effect of nim compiler not knowing what c compiler will do |
22:58:43 | FromDiscord | <Elegantbeef> Eh `sizeof` is a magic and doesnt rely on the C compiler |
22:59:04 | FromDiscord | <Elegantbeef> Well i should say it doesnt rely on the C compiler for Nim created types ๐ |
22:59:11 | FromDiscord | <Elegantbeef> same for `offsetOF` |
22:59:32 | FromDiscord | <.tochka> then its probably a solved issue, hm |
22:59:54 | FromDiscord | <Elegantbeef> To reply, I dont really know what to say, is it possibly an issue with the library you're usingโต(@voidwalker) |
23:01:15 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/sizealignoffsetimpl.nim |
23:01:49 | FromDiscord | <Elegantbeef> 100% undocumented cause you're supposed to know how this all behaves ๐ |
23:03:10 | FromDiscord | <.tochka> hm, if you try to make reordering macro, you wouldn't know the sizes of generic fields at macro expansion right? |
23:05:31 | FromDiscord | <Elegantbeef> Sadly though typesection macros cannot be typed so i guess you cannot really make a nice alignment macro that's just a pragma |
23:06:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg6 |
23:07:56 | FromDiscord | <guttural666> any way to shorten object construction in a sequence a bit? something like this? according to the manual there does not seem to be https://media.discordapp.net/attachments/371759389889003532/1043301564175097896/image.png |
23:08:21 | FromDiscord | <Elegantbeef> Make a constructor |
23:09:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg7 |
23:09:57 | FromDiscord | <guttural666> hmmmm |
23:10:28 | FromDiscord | <Elegantbeef> Never use `new` for a `object` only use it for a `ref` |
23:10:28 | FromDiscord | <Elegantbeef> In Nim `new` has the semantic it's heap allocated |
23:10:29 | FromDiscord | <guttural666> _: is unnamed? |
23:10:47 | FromDiscord | <Elegantbeef> `_` means you dont care about the variable and Nim prevents you from accessing it |
23:10:48 | FromDiscord | <guttural666> ref would be heap allocated automatically? |
23:10:55 | FromDiscord | <guttural666> very nice |
23:10:56 | FromDiscord | <Elegantbeef> "automatically" |
23:11:17 | FromDiscord | <Elegantbeef> ref isnt heap allocated automatically, refs are heap allocated types |
23:11:37 | FromDiscord | <Elegantbeef> `var a: ref int; assert a.isNil` |
23:12:03 | FromDiscord | <guttural666> that's what I meant |
23:12:53 | FromDiscord | <guttural666> okay, so there are no less verbose ways to construct out of the box, but I could add a simpler constructor function |
23:12:58 | FromDiscord | <guttural666> thanks Elegant |
23:13:51 | FromDiscord | <guttural666> would have expected some sort of type deduction when adding something to a seq tho |
23:14:11 | FromDiscord | <Elegantbeef> Nim only does local inference which means right to left |
23:14:41 | FromDiscord | <Elegantbeef> Also that's a weird specialisation of a object constructor that only works in dispatch |
23:14:41 | FromDiscord | <guttural666> got it |
23:14:52 | FromDiscord | <Elegantbeef> As if procedure dispatch isnt already very complicated |
23:16:20 | FromDiscord | <guttural666> couldn't say, but thanks for the in depth explanation |
23:17:12 | * | jjido joined #nim |
23:23:53 | * | xet7 quit (Quit: Leaving) |
23:41:54 | * | m5zs7k quit (Ping timeout: 260 seconds) |
23:42:33 | * | m5zs7k joined #nim |
23:48:41 | FromDiscord | <Tuatarian> Beef do you have a potential solution to the problem I had above? |
23:49:02 | FromDiscord | <Tuatarian> 8m not home at the moment but I'm curious how your get around that |
23:50:05 | FromDiscord | <Elegantbeef> Which issue? |
23:51:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggd |
23:54:37 | FromDiscord | <Tuatarian> Really? |
23:54:43 | FromDiscord | <Tuatarian> It wasn't compiling for me... |
23:54:50 | FromDiscord | <Elegantbeef> Would i lie to you? |
23:54:52 | FromDiscord | <Tuatarian> Wonder if I accidentally did something strange |
23:54:57 | FromDiscord | <Tuatarian> No lmao I'm just confused |
23:55:32 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gge |
23:56:15 | FromDiscord | <Tuatarian> Might be emacs weirdness? This wouldn't be the first time I've had something fail to compile in emacs that would compile normally |