<< 18-11-2022 >>

00:06:52FromDiscord<! Nilts> how to i echo indented json?
00:07:09FromDiscord<Rika> https://nim-lang.org/docs/json.html#pretty%2CJsonNode%2Cint
00:07:25FromDiscord<! Nilts> thanks
00:09:10FromDiscord<! Nilts> yay! my `TomlValueRef` to `JsonNode` converter is complete!
00:12:42FromDiscord<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:05FromDiscord<Elegantbeef> What do you mean it's just `toFlatty`/`fromFlatty`
00:16:29FromDiscord<qb> btw. Is there no support for `Toml.to(object`?
00:16:57FromDiscord<qb> I would need to use `Toml.toJson().to(object)` huh?
00:17:26FromDiscord<qb> (edit) "`Toml.to(object`?" => "`Toml.to(object)`?"
00:19:24FromDiscord<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:15FromDiscord<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:47FromDiscord<Array in a Matrix> sent a code paste, see https://paste.rs/0Le
01:26:36FromDiscord<Array in a Matrix> sent a code paste, see https://play.nim-lang.org/#ix=4gbi
01:28:40FromDiscord<Array in a Matrix> sent a code paste, see https://play.nim-lang.org/#ix=4gbj
01:29:47FromDiscord<Elegantbeef> `matrix: var seq[seq[float]]`
01:30:45FromDiscord<Elegantbeef> Parameters are immutable by default in Nim
01:30:55FromDiscord<Elegantbeef> You need to say "This is a mutable parameter"
01:33:02FromDiscord<Array in a Matrix> ohh
01:33:05FromDiscord<Array in a Matrix> thank you
01:38:16*derpydoo joined #nim
01:45:41FromDiscord<ChocolettePalette> Unless they're refs and even though mutable refs are kinda pointless
01:45:55FromDiscord<Elegantbeef> Eh they're still immutable
01:46:04FromDiscord<Elegantbeef> reference fields are mutable
01:46:32FromDiscord<Elegantbeef> I wouldnt say mutable references are kinda pointless, if you want to change where it points to you need it
01:46:58FromDiscord<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:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gbl
01:48:24FromDiscord<Elegantbeef> I mean there are reasons you'd want `var MyRef`
01:48:35FromDiscord<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:44FromDiscord<Array in a Matrix> where can i read more about the documentation generated by the nim compiler?
02:08:59FromDiscord<Elegantbeef> https://nim-lang.org/docs/docgen.html
02:13:19FromDiscord<Array in a Matrix> thanks
02:46:25FromDiscord<SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbp
02:46:36FromDiscord<SBG> `Error: unhandled exception: index 2 not in 0 .. 1 [IndexDefect]`
02:46:43FromDiscord<SBG> is it because its not expecting paramStr(2)?
02:46:48FromDiscord<Elegantbeef> `paramStr(2)`
02:47:08FromDiscord<Elegantbeef> `or (paramCount > 2 and paramStr(2) == "--ignore")`
02:47:15FromDiscord<SBG> ohhh
02:47:21FromDiscord<SBG> I didn't use brackets
02:47:23FromDiscord<SBG> I tried and
02:59:08*arkurious quit (Quit: Leaving)
03:02:55*vicecea joined #nim
03:05:27FromDiscord<voidwalker> https://nim-lang.org/docs/sha1.html#SecureHash - how do I turn this into a string?
03:05:40FromDiscord<voidwalker> (edit) "string?" => "string with the exact same byte values ?"
03:05:46FromDiscord<Elegantbeef> `$`
03:05:51FromDiscord<voidwalker> (edit) "?" => "(not the hex respresentation)?"
03:06:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gby
03:07:07FromDiscord<voidwalker> oh no ๐Ÿ˜ฆ
03:07:17FromDiscord<Elegantbeef> What?
03:07:36FromDiscord<voidwalker> that's 4 lines.. I expected a few chars, same line : D
03:07:53FromDiscord<Elegantbeef> You can also do `Sha1Digest(myDigest)` instead of `import std/typetraits`
03:08:00FromDiscord<Elegantbeef> I just find `distinctBase` a tinge easier
03:08:55FromDiscord<Elegantbeef> But i'll hate you
03:08:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gbA
03:08:58FromDiscord<Elegantbeef> One statement per line!
03:09:13FromDiscord<voidwalker> unless it's small trivial staements that are related : P
03:09:20FromDiscord<Elegantbeef> Regardless
03:09:55FromDiscord<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:21FromDiscord<Elegantbeef> arrays are static sized and stack allocated, sequences/strings are dynamic heap allocated
03:11:30FromDiscord<Elegantbeef> You cannot get one to the other without an allocation
03:32:30FromDiscord<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:32FromDiscord<SBG> In reply to @Elegantbeef "`or (paramCount > 2": wait that presented further issues
03:33:12FromDiscord<SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbC
03:33:26FromDiscord<Elegantbeef> I believe in you!
03:33:44FromDiscord<Elegantbeef> `got <int literal(2), proc (): int{.gcsafe, locks: 0.}>`
03:35:55FromDiscord<Rika> Beef you didnโ€™t call the count function
03:36:20FromDiscord<Rika> Smh
03:36:40FromDiscord<SBG> i dont see the issue there
03:37:00FromDiscord<SBG> or if paramCouter is greater than two, and the second value is equaled to "--ignore" then
03:37:38FromDiscord<Rika> Count is a function
03:37:40FromDiscord<Rika> Call it
03:37:50FromDiscord<Rika> paramCount() > 2
03:38:44FromDiscord<SBG> jesus christ
03:38:50FromDiscord<SBG> i want to curl up into a ball
03:38:59FromDiscord<SBG> please ignore me
03:39:15FromDiscord<Rika> Lol itโ€™s fine
03:39:19FromDiscord<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:28FromDiscord<Rika> Donโ€™t worry too much
03:39:42FromDiscord<Rika> Itโ€™s fine
03:40:07FromDiscord<SBG> wait is the `if not dirExists(virtDir) or (paramCount() > 2 and paramStr(2) == "--ignore"):` 'not' also applying to the second condition
03:49:22FromDiscord<SBG> So like is the not in if not applying to both of the conditions?
03:51:09FromDiscord<Elegantbeef> Or is blow
03:51:11FromDiscord<Elegantbeef> below even
03:51:15FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#syntax-precedence
03:55:18*TakinOver joined #nim
03:58:27FromDiscord<SBG> In reply to @Elegantbeef "Or is blow": what?
03:58:50FromDiscord<SBG> ohh
03:59:00FromDiscord<SBG> sent a code paste, see https://play.nim-lang.org/#ix=4gbD
03:59:30FromDiscord<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:31FromDiscord<SBG> it dpesn
03:59:42FromDiscord<SBG> (edit) "dpesn" => "the --ignore flag runs the else"
03:59:46FromDiscord<SBG> which is why i asked my question
04:00:25FromDiscord<Elegantbeef> `not` is done before `or` so `not a or b` is `not(a) or b`
04:01:52FromDiscord<Elegantbeef> you can also just do `not(dirExists(virtDir))`
04:01:54FromDiscord<Elegantbeef> is your issue
04:01:56FromDiscord<Elegantbeef> `paramCount > 2`
04:01:56FromDiscord<Elegantbeef> `>=` 2
04:02:07FromDiscord<SBG> OH right
04:02:16FromDiscord<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:59FromDiscord<MilesTheFox> How to enable extended CPU instruction sets?
04:45:10FromDiscord<MilesTheFox> Like ``-msse4.1``, but in Nim
04:45:55FromDiscord<Elegantbeef> `--passC:"-msse4.1"` likely
04:46:07FromDiscord<MilesTheFox> Thank you!
04:47:32FromDiscord<alicia ใƒƒ> why did the dev decide on 2 spaces
04:47:37FromDiscord<alicia ใƒƒ> it is really really hard to read code
04:49:03FromDiscord<Elegantbeef> You can use any indention level you want
04:50:57FromDiscord<huantian> 2 spaces is just the general convention
04:54:53FromDiscord<alicia ใƒƒ> In reply to @huantian "2 spaces is just": why though
04:54:59FromDiscord<alicia ใƒƒ> im aware but why is 2 the default
04:55:02FromDiscord<alicia ใƒƒ> its so hard to read
04:55:35FromDiscord<Rika> Because thereโ€™s a good amount of people here who do not share your opinion
04:55:36FromDiscord<Elegantbeef> Cause it hides all of the indention hell in the compiler
04:55:36FromDiscord<Elegantbeef> Jokes aside i assume it's probably a convention from pascal
04:55:57FromDiscord<alicia ใƒƒ> In reply to @Rika "Because thereโ€™s a good": im not flaming, just curious
04:56:01FromDiscord<alicia ใƒƒ> most languages use 4
04:56:10FromDiscord<huantian> wait pascal uses 2?
04:56:11FromDiscord<Rika> No I mean that in a normal way
04:56:33FromDiscord<Rika> In reply to @alicia ใƒƒ "most languages use 4": There are other languages that use 2
04:56:42FromDiscord<alicia ใƒƒ> i cant think of one
04:57:12FromDiscord<Rika> Elixir comes to mind
04:57:16FromDiscord<Rika> Lol
04:57:26FromDiscord<huantian> uhhh nix expression lang uses 2 spsaces
04:57:36FromDiscord<Rika> Lol
04:58:29FromDiscord<alicia ใƒƒ> TIL
04:58:33FromDiscord<alicia ใƒƒ> i thought elixir was 4
04:59:23FromDiscord<huantian> I think nix uses 2 because it gets omega indented
05:02:24FromDiscord<Phytolizer> Haskell does too right?
05:02:34FromDiscord<Phytolizer> Ormolu formatter anyway
05:03:01FromDiscord<Rika> Iโ€™d think so yes
05:03:41FromDiscord<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:35FromDiscord<huantian> yeah same
05:05:49FromDiscord<huantian> also nice phytogrow pfp
05:06:01FromDiscord<huantian> sorry phyto gro
05:06:30FromDiscord<alicia ใƒƒ> In reply to @Phytolizer "It's strange though, I": im not sure why it does but agreed
05:07:14FromDiscord<Phytolizer> In reply to @huantian "sorry phyto gro": Finally someone recognizes it lol
05:07:46FromDiscord<Rika> Try finding a language with 3 indent spaces as standard though
05:07:57FromDiscord<Phytolizer> Or 5 :elmoburn:
05:08:09FromDiscord<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:21FromDiscord<Phytolizer> Or each indent level is the next number in the Fibonacci sequence
05:08:37FromDiscord<Phytolizer> In reply to @huantian "there's probably not many": Oh yeah it makes total sense
05:10:36FromDiscord<Rika> In reply to @Phytolizer "Or each indent level": Factorial
05:11:06FromDiscord<alicia ใƒƒ> i like modded mc
05:11:11FromDiscord<alicia ใƒƒ> but no i havent used phyto gro
05:14:48*rockcavera quit (Remote host closed the connection)
05:39:52FromDiscord<huantian> Still advocating for a Nim discord server modded mc server
05:39:56FromDiscord<huantian> ๐Ÿ˜›
05:40:09FromDiscord<Elegantbeef> Be the change you want to be in the world
05:40:20FromDiscord<Elegantbeef> see but yea
05:40:23FromDiscord<Elegantbeef> Words are hard
05:40:30FromDiscord<Elegantbeef> They really are
05:42:06FromDiscord<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:46FromDiscord<huantian> Ngl I am kinda confused what youโ€™re correcting yourself here with
05:46:50FromDiscord<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:59FromDiscord<huantian> Huh
05:48:06FromDiscord<huantian> Maybe I missed that then lol
05:51:15*NimEventer quit (Ping timeout: 260 seconds)
05:51:56*NimEventer joined #nim
06:09:18FromDiscord<Phytolizer> oh that thing
06:42:53*ixmpp joined #nim
06:49:20*nisstyre quit (Quit: WeeChat 3.4)
06:50:40FromDiscord<scarf> does sequtil use iterators
06:51:39FromDiscord<Elegantbeef> Nope
06:53:19*nisstyre joined #nim
06:58:32FromDiscord<scarf> that's a sad news (in terms of performance), is it impossible to implement?
06:58:51FromDiscord<scarf> (edit) "implement?" => "implement in current syntax?"
06:58:59FromDiscord<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:52FromDiscord<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:00FromDiscord<scarf> abobut optimisations, does it mean using iterators is not enough?
07:02:08FromDiscord<scarf> (edit) "enough?" => "enough for performance gain?"
07:02:26FromDiscord<Elegantbeef> Closure iterators are likely slower than `sequtils` but inline will be faster
07:03:18FromDiscord<Elegantbeef> Inline iterators are as fast as you can feasibly go, closure iterators are slower due to them being pointer procs
07:04:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc5
07:04:22FromDiscord<Elegantbeef> The latter will be faster due to how closures operate
07:04:23FromDiscord<scarf> sequtil doesn't use `{.inline.}` but `{.closure.}` , could you tell me why?
07:04:52FromDiscord<Elegantbeef> Cause closure works with `{.nimCall.}` and `{.closure.}`
07:05:01FromDiscord<Elegantbeef> That's not even the one issue i'm talking about
07:05:18FromDiscord<Elegantbeef> That also adds a performance cost
07:05:48FromDiscord<Elegantbeef> The `it` variants are likely faster
07:06:36FromDiscord<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:08FromDiscord<scarf> oh, then is sequence fastest among all?
07:07:15FromDiscord<Elegantbeef> Slowest
07:07:31FromDiscord<Elegantbeef> Heap allocations are bad
07:07:34FromDiscord<Elegantbeef> ๐Ÿ˜›
07:07:44FromDiscord<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:58FromDiscord<Elegantbeef> No seq utils doesnt use closure iterators
07:08:05FromDiscord<Elegantbeef> It uses sequences which is why it's slow
07:08:33FromDiscord<scarf> ok, would there be any difficulties from changing its implementation to inline iterator?
07:08:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc6
07:09:23FromDiscord<scarf> ...oh, yeah, I just remembered, any functional programming languages would create a copy of given sequence
07:09:43FromDiscord<scarf> so in this case sequtil is working as correctly
07:10:07FromDiscord<Elegantbeef> In many cases that people use sequtils it's "incorrect"
07:10:13FromDiscord<Elegantbeef> They chain them and or iterate them
07:10:46FromDiscord<scarf> they look chainable tho
07:10:52FromDiscord<scarf> (edit) "they look ... chainable" added "very"
07:10:57FromDiscord<Elegantbeef> They are but that's "incorrect"
07:11:16FromDiscord<Elegantbeef> Each chain allocates
07:11:18FromDiscord<scarf> I wonder how functional programming languages handle long chains
07:11:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc7
07:11:29FromDiscord<Elegantbeef> They do an optimisation
07:11:32FromDiscord<Elegantbeef> Nim doesnt have this optimisation
07:11:51FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1043060958672723988/image.png
07:12:07FromDiscord<Elegantbeef> But yea if you care these are the results from that benchmark on slicerator
07:13:32FromDiscord<scarf> In reply to @Elegantbeef "They do an optimisation": https://github.com/zero-functional/zero-functional looks promising but its `-->` is ugly
07:13:54FromDiscord<Elegantbeef> Yea it's an alternative
07:14:01FromDiscord<Elegantbeef> Personally i think `chain` is the right approach
07:14:03FromDiscord<Elegantbeef> But i dont know
07:14:57FromDiscord<scarf> In reply to @Elegantbeef "Personally i think `chain`": is it a proc? or `std/chains`?
07:15:06FromDiscord<Elegantbeef> It's in slicerator
07:15:10FromDiscord<Elegantbeef> I linked it
07:15:22FromDiscord<scarf> nice
07:17:02FromDiscord<scarf> do you plan to include it in stdlib?
07:17:11FromDiscord<Elegantbeef> Nope
07:17:40FromDiscord<scarf> yours look very performant tho
07:18:16FromDiscord<Elegantbeef> It also uses a weird syntax and isnt really FP
07:18:35FromDiscord<Elegantbeef> It unrolls into the equivalent human written code
07:19:59FromDiscord<scarf> oh, missed that `chain` was needed to execute it
07:20:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gc9
07:20:46FromDiscord<Elegantbeef> Is having that syntax sugar really worth it, i dont know
07:25:30FromDiscord<scarf> love me some sugar
07:25:53FromDiscord<Elegantbeef> Well then use my package and complain about how it's likely broken or undocumented
07:27:46FromDiscord<scarf> anyways it was fun learning all these
07:29:33*kenran joined #nim
07:33:20FromDiscord<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:16FromDiscord<Elegantbeef> A symbol cannot be used before it's declaration
07:34:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gcc
07:39:38*PMunch joined #nim
07:43:39FromDiscord<dizzyliam [they/them]> sent a code paste, see https://play.nim-lang.org/#ix=4gce
07:43:50FromDiscord<Elegantbeef> Yes you can use anonymous procs
07:44:43FromDiscord<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:48FromDiscord<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:58FromDiscord<dizzyliam [they/them]> In reply to @Elegantbeef "Yes you can use": Ah, a keyword I can search. Thanks :)
07:48:20FromDiscord<Elegantbeef> You do not need to do anything
07:49:41PMunch@Require_Support, if you create a thread and your program exits then the thread will get killed
07:50:12PMunchEven if it hasn't finished executing its procedure
07:50:51*kenran quit (Remote host closed the connection)
07:56:50PMunchdizzyliam_[they/them], typically you would call those closures
07:56:59PMunchProcedures created within another procedure
07:57:35FromDiscord<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:18FromDiscord<Elegantbeef> Pmunch you do not call those closures
07:59:32FromDiscord<Elegantbeef> Closures are only closures if they store an environment
08:00:01PMunchSure, but every proc created within a proc in Nim store their environment
08:00:10FromDiscord<Elegantbeef> No they dont
08:00:17PMunchDon't they?
08:00:34FromDiscord<Elegantbeef> If you want to be pedantic, yes
08:01:31FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4gco
08:03:32PMunchIndeed Nim seems to check if it actually needs to capture anything from the environment: https://play.nim-lang.org/#ix=4gcp
08:03:58PMunchThis has interesting ramifications
08:05:43FromDiscord<scarf> that share to ix makes me wonder how come ix.io can handle all the bandwidth
08:05:51FromDiscord<scarf> (edit) "share" => "`share" | "ix" => "ix` button"
08:06:38FromDiscord<Rika> Itโ€™s not a lot to serve text
08:08:20PMunchYeah, text is pretty cheap
08:09:51FromDiscord<Elegantbeef> There arent many ramifications to be fair
08:09:57FromDiscord<Elegantbeef> Nimcall -\> closure is implicit
08:10:41FromDiscord<Elegantbeef> Of course you need to mark a anonymous procedure if you want it as a closure though
08:10:57PMunchWell I was considering a nice interface for Ratel interrupts
08:16:56FromDiscord<Elegantbeef> But now you're considering a bad interface? ๐Ÿ˜„
08:23:47PMunchHaha, 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:05FromDiscord<Elegantbeef> you can take static procs
08:24:12FromDiscord<Elegantbeef> Can also take `proc(){.nimcall.}`
08:26:16FromDiscord<Elegantbeef> Static procs if you dont know directly call the procedure 0 indirection
08:28:44*jjido joined #nim
08:34:29PMunchstatic procs?
08:35:01FromDiscord<Rika> Compile time value procedures
08:35:33FromDiscord<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:06PMunchAnd those won't be `proc () {.compileTime.}`?
08:57:28FromDiscord<Elegantbeef> Nope
08:57:38FromDiscord<Elegantbeef> Those are nimcalls that are callable at runtime
08:59:42FromDiscord<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:02FromDiscord<Elegantbeef> It's the same as a template that takes a proc and inserts a call
09:01:13FromDiscord<Elegantbeef> Inotherwords my remoterefs stuff enables custom allocators without any arena/context, uses Nim's RAII, and also can inline allocation calls ๐Ÿ˜„
09:13:29PMunchStill not entirely sure what the difference between proc and static proc would be
09:13:42FromDiscord<Elegantbeef> pointer proc vs directly called
09:13:48FromDiscord<Elegantbeef> the latter is more likely to be inlined
09:13:55PMunchBut what does directly called mean?
09:14:39FromDiscord<Elegantbeef> Like if instead of you taking a parameter you called the proc that the procedure called directly
09:15:05FromDiscord<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:42PMunchAah right
09:27:34FromDiscord<graham_o> sent a long message, see http://ix.io/49IZ
09:31:47FromDiscord<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:53PMunchNothing that's open. Apart from "don't be an asshole"
09:35:15FromDiscord<Elegantbeef> Yet somehow i persist
09:35:31PMunchWell, there are different levels of assholery
09:36:18FromDiscord<Elegantbeef> Shit i need to get my bingo card
09:36:50FromDiscord<haxscramper> You don't have any external written descriptions either?
09:37:24FromDiscord<haxscramper> "nothing that's open" -- anything that is closed?
09:37:55FromDiscord<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:03FromDiscord<Elegantbeef> Seems like they have a checklist to keep people around ๐Ÿ˜„
09:41:40*jmdaemon quit (Ping timeout: 260 seconds)
09:43:26FromDiscord<haxscramper> yeah, but it's been ~year since then so I'm wondering if there are any results
09:47:14PMunchWe'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:47PMunchThe 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:56PMunchWe now have a sort of process for moderation, but nothing is chiselled in stone, but that is partially by design
09:50:43PMunch@haxscramper, does that answer your question?
09:51:45FromDiscord<haxscramper> Yyes, it does answer my question
09:51:51FromDiscord<haxscramper> (edit) "Yyes," => "Yes,"
09:52:40PMunchWe'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:30FromDiscord<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:55FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4gcU
10:11:57FromDiscord<MilesTheFox> How to use Clang instead of GCC?
10:15:46FromDiscord<ShalokShalom> --cc:gcc
10:16:02FromDiscord<ShalokShalom> In reply to @MilesTheFox "How to use Clang": https://nim-lang.org/docs/nimc.html#compiler-selection
10:16:19FromDiscord<ShalokShalom> (edit) "--cc:gcc" => "--cc:llvm"
10:17:38FromDiscord<ShalokShalom> (edit) "https://nim-lang.org/docs/nimc.html#compiler-selection" => "https://nim-lang.org/docs/nimc.html#compiler-usage"
10:19:10FromDiscord<MilesTheFox> I just realized that Clang is slow XD
10:20:19FromDiscord<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:28FromDiscord<Yardanico> In reply to @ShalokShalom "--cc:llvm": --cc:clang
10:20:29FromDiscord<Yardanico> not llvm
10:20:50FromDiscord<Yardanico> In reply to @MilesTheFox "I just realized that": it's not really
10:21:22FromDiscord<MilesTheFox> With Clang it took 1 minute to compile my app XD
10:21:31FromDiscord<MilesTheFox> With GCC it took only 10 seconds
10:21:51FromDiscord<Yardanico> weird then
10:21:53FromDiscord<MilesTheFox> (I use 11 years old laptop)
10:22:03FromDiscord<ShalokShalom> In reply to @Yardanico "--cc:clang": Thanks. The docs dont say that
10:22:08FromDiscord<Yardanico> In reply to @MilesTheFox "(I use 11 years": do you have any gcc-specific options set?
10:22:27FromDiscord<fbpyr> for quick compiling feedback in inim I like using `tcc`
10:22:56FromDiscord<fbpyr> but have not used in on any larger project.
10:23:12FromDiscord<ShalokShalom> https://nim-lang.org/docs/nimc.html#compiler-selectionโ†ตโ†ตDo you know whatโ†ต--cc:llvm_gcc does?
10:23:19FromDiscord<DarkSky> are there any Neovim plugins for Nim?
10:23:21FromDiscord<DarkSky> couldnt find any
10:23:34FromDiscord<Yardanico> :P https://media.discordapp.net/attachments/371759389889003532/1043109200491978752/image.png
10:23:37FromDiscord<Yardanico> https://github.com/alaviss/nim.nvim
10:23:49FromDiscord<ShalokShalom> The LSP one works for it as well, I guess
10:23:59FromDiscord<DarkSky> In reply to @Yardanico ":P": my blind ass could swear i havent seen that link before lol. thanks
10:24:03FromDiscord<Yardanico> In reply to @ShalokShalom "The LSP one works": nvim has better integration as it uses nimsuggest directly
10:24:07FromDiscord<ShalokShalom> NeoNim
10:24:10FromDiscord<Yardanico> "Semantic highlighting with nimsuggest. Highlight as you type (experimental)"
10:24:13FromDiscord<Yardanico> and this too
10:24:19FromDiscord<ShalokShalom> I see, super
10:24:32FromDiscord<ShalokShalom> The documentation around - - cc: seems lackluster
10:24:43FromDiscord<ShalokShalom> There are not really any of the options listed
10:24:58FromDiscord<ShalokShalom> I guess there is msvc and intel too?
10:25:03FromDiscord<ShalokShalom> How is their handle?
10:25:18FromDiscord<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:23FromDiscord<Yardanico> llvm frontend for gcc
10:25:39FromDiscord<Yardanico> In reply to @ShalokShalom "There are not really": yeah, a good first PR
10:25:47FromDiscord<Yardanico> list is in https://github.com/nim-lang/Nim/blob/devel/compiler/extccomp.nim
10:28:21FromDiscord<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:31FromDiscord<Yardanico> In reply to @zidsal "if I pas an": it'll make a copy if the object is small enough
10:28:39FromDiscord<Jessa> sent a code paste, see https://paste.rs/H4I
10:28:47FromDiscord<Yardanico> currently the hard-coded limit is 24 bytes for pass-by-ref for objects
10:29:02FromDiscord<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:14FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4gd1
10:29:20FromDiscord<Yardanico> if you want to make a lookup table you should assign keys to actual procedures, not the types
10:29:31FromDiscord<Yardanico> and also `lookup: Table` is wrong since you're not specifying the whole type
10:29:41FromDiscord<Yardanico> either do Table[string, MyProcType] or just don't specify the type (for auto inference)
10:30:13FromDiscord<b1rdf00d> doesn't the nim compiler try to move variables, unless they are used again after the function call site?
10:30:31FromDiscord<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:53FromDiscord<Yardanico> In reply to @Jessa "can i get a": depends on where the string will come from
10:31:09FromDiscord<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:38FromDiscord<Yardanico> In reply to @Jessa "i see why": what tutorial is that?
10:31:46FromDiscord<Yardanico> ah you're looking at dynlib
10:32:02FromDiscord<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:06FromDiscord<ShalokShalom> In reply to @Yardanico "llvm frontend for gcc": What's the point of a llvm frontend for gcc?
10:32:07FromDiscord<Yardanico> If you're using pure Nim you don't need that
10:32:17FromDiscord<Yardanico> In reply to @ShalokShalom "What's the point of": because clang didn't always exist
10:32:24FromDiscord<Yardanico> at first llvm actually wanted to integrate with gcc
10:32:28FromDiscord<ShalokShalom> Ah, I see
10:32:33FromDiscord<albassort> @Yardanico how do types which are just aliases eg ``type x = string`` work on the backend
10:32:33FromDiscord<ShalokShalom> I didn't even know thaz
10:32:35FromDiscord<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:49FromDiscord<Yardanico> In reply to @albassort "<@177365113899057152> how do types": wdym? they're literally just aliases
10:32:58FromDiscord<albassort> so then why do aliases have a limit
10:33:02FromDiscord<Yardanico> what limit?
10:33:10FromDiscord<albassort> i misunderstood you
10:33:11FromDiscord<albassort> nevermind
10:33:30FromDiscord<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:37FromDiscord<albassort> i thought you meant you cant have an alias with type info larger than 24bytes
10:33:39FromDiscord<Yardanico> if your procedures have different signatures you'll have to do type erasure and save the type info elsewhere
10:33:47FromDiscord<Yardanico> In reply to @albassort "i thought you meant": that's about pass-by-copy or pass-by-ref for objects
10:34:08FromDiscord<albassort> yea i was like "oh so are these types more than just aliases in the backend"
10:34:18FromDiscord<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:54FromDiscord<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:57FromDiscord<Yardanico> for small objects
10:35:05FromDiscord<zidsal> huh til
10:35:14FromDiscord<Yardanico> since if you pass by reference, you have to dereference it
10:36:48FromDiscord<Yardanico> see e.g. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in
10:39:50FromDiscord<MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4gd4
10:40:01FromDiscord<Yardanico> on windows?
10:40:26FromDiscord<MilesTheFox> https://media.discordapp.net/attachments/371759389889003532/1043113443152109578/image.png
10:40:28FromDiscord<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:37FromDiscord<Yardanico> and if you want to compile for your own CPU, just do `-march=native`
10:40:45FromDiscord<Yardanico> but still, clang being slow here is really weird, it is on par or faster for me usually
10:40:49FromDiscord<MilesTheFox> I'm doing that for modern CPUs
10:40:49FromDiscord<Yardanico> especially a 6x difference
10:41:00FromDiscord<MilesTheFox> In reply to @MilesTheFox "I'm doing that for": Also VM protection
10:41:24FromDiscord<Yardanico> In reply to @MilesTheFox "I'm doing that for": then use `x86-64-v3` ?
10:41:31FromDiscord<Yardanico> `-march=x86-64-v3`
10:41:50FromDiscord<MilesTheFox> In reply to @Yardanico "then use `x86-64-v3` ?": I still wanna test it (I use Intel Celeron B815)
10:42:25FromDiscord<Yardanico> okay, so you don't have any .nims or .cfg files with specific config options? and did you try multiple times?
10:42:32FromDiscord<Yardanico> because nim caches C object files
10:42:40FromDiscord<Yardanico> try `--forceBuild` for both gcc and clang
10:42:44FromDiscord<Yardanico> that's a nim compiler argument
10:42:48FromDiscord<MilesTheFox> I don't have any configs
10:43:14FromDiscord<MilesTheFox> In reply to @Yardanico "try `--forceBuild` for both": GCC is still faster
10:43:22FromDiscord<Yardanico> interesting
10:43:27FromDiscord<Yardanico> by much?
10:43:32FromDiscord<MilesTheFox> Yeah
10:43:39FromDiscord<Yardanico> really weird
10:44:39FromDiscord<MilesTheFox> It takes ~10-15 seconds to compile 2 C objects
10:44:46FromDiscord<MilesTheFox> On Clang
10:44:52FromDiscord<MilesTheFox> On GCC less than second
10:45:22*jjido joined #nim
10:45:27FromDiscord<Yardanico> that might be a clang bug, or some misconfiguration, I can't say anything more specific :P
10:45:42FromDiscord<MilesTheFox> Okayy
10:46:16FromDiscord<MilesTheFox> Also, I heard it's possible to embed executable inside Nim app
10:46:31FromDiscord<Yardanico> depends on what do you want to do with it, yers
10:46:53FromDiscord<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:01FromDiscord<MilesTheFox> I don't wanna write a file.
10:48:07FromDiscord<MilesTheFox> I don't wanna do any file operations
10:48:38FromDiscord<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:39FromDiscord<MilesTheFox> Even non-malware requires it because all AVs are helly annoying
10:49:51FromDiscord<Yardanico> i think by doing that you'll only alert AVs more
10:49:56FromDiscord<Yardanico> by embedding executables I mean
10:50:01FromDiscord<MilesTheFox> I remember app that just makes text file was marked as malware by at least 3 AVs
10:50:22FromDiscord<zidsal> getting your applications signed is the best way to stop that (in theory) Miles
10:50:53FromDiscord<MilesTheFox> In reply to @zidsal "getting your applications signed": I'm not gonna talk with them because I hate AVs
10:50:59FromDiscord<MilesTheFox> The only good AV is ClamAV
10:51:12FromDiscord<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:13FromDiscord<MilesTheFox> Open-source, stable, fast and no false-positives
10:51:23FromDiscord<Yardanico> > no false-positives
10:51:25FromDiscord<Yardanico> surely
10:52:07FromDiscord<MilesTheFox> In reply to @Isofruit "AFAIK getting a nim": I even unhooked ntdll
10:52:33FromDiscord<MilesTheFox> AVs use ntdll to scan malware in real-time (it also makes apps very slow)
10:53:21FromDiscord<MilesTheFox> And if they find any suspicious or weird behavior, they immediately terminate or suspend this process
10:54:17FromDiscord<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:42FromDiscord<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:02PMunch@qb you could use min and max to shorten the code
12:19:22PMunchBy the way you have a bug with the bottom right pair
12:20:35PMunchThis is the bounding code I have in SDLGamelib: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/collisions.nim#L98-L109
12:20:49PMunchBut that returns x/y and a width and height, so it's slightly different
13:10:05FromDiscord<qb> I see. I guess I could calculate top right and bottom left if I got top left and bottom right
13:10:12FromDiscord<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:13PMunchOh yeah, you only need to find minX, minY, maxX, and maxY
13:27:21*rockcavera joined #nim
13:27:46PMunchSo 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:40arkanoidis there a Nim library to make agent based models? Otherwise I would just implement it
13:34:25PMunchAgent based models?
13:51:30FromDiscord<qb> In reply to @PMunch "So loop through all": Thanks. A lot sexier https://play.nim-lang.org/#ix=4gdK
13:53:13FromDiscord<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:22FromDiscord<Gumbercules> In reply to @voidwalker "How to preallocate a": If you can do it with C you can do it with Nim
14:06:50FromDiscord<voidwalker> I know, but if I wanted to do C, I'd not be here : P
14:08:58FromDiscord<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:16FromDiscord<ratapenado> Hello, I remember a debate to know if Nim 2.0 would be case sensitive, what was decided at the end ?
14:09:30FromDiscord<Gumbercules> There's no `createSparseFile` function in the stdlib as far as I'm aware
14:09:38FromDiscord<voidwalker> I never looked at the C code, so from my point of view, I am only doing C code
14:09:49FromDiscord<voidwalker> (edit) "C" => "nim"
14:10:17FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4gdS
14:10:27FromDiscord<Gumbercules> In reply to @voidwalker "I never looked at": well, that's certainly one way to look at things...
14:10:31FromDiscord<ratapenado> In reply to @PMunch "Agent based models?": It's a simulation model based on autonomous agents
14:11:09FromDiscord<ratapenado> In reply to @Gumbercules "well, that's certainly one": Well that's the point of programming in Nim, no?
14:11:20FromDiscord<Gumbercules> What's the point of programming in Nim?
14:11:30FromDiscord<Gumbercules> I'm confused by your question
14:11:51FromDiscord<Gumbercules> Not having to think about C?
14:12:15FromDiscord<Gumbercules> You'll be a much better Nim programmer (assuming you're targeting the C backend) if you know C well.
14:12:22PMunch@ratapenado, I believe (and certainly hope) that it won't be removed for Nim 2.0
14:12:48FromDiscord<voidwalker> Too early to think about that. I first want to become a nim programmer. Becoming good is a later goal.
14:13:25FromDiscord<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:42FromDiscord<Gumbercules> When I want to do something in Nim and I don't know how, I look for an example in C
14:13:54FromDiscord<Gumbercules> and then I replicate that in Nim using the stdlib or wrapping C by hand if I need to
14:14:06FromDiscord<Gumbercules> so for this example I simply googled "sparse file creation in C"
14:14:18FromDiscord<voidwalker> my goal now is to writite a minimally functional torrent client in the minimum number of LOC
14:14:58FromDiscord<voidwalker> So I can't wrap anything, gotta use what I have : )
14:15:34FromDiscord<Gumbercules> Minimum lines of code in what language?
14:15:45FromDiscord<Gumbercules> because Nim is going to spit out C and then C is going to be compiled by your C compiler
14:15:45FromDiscord<voidwalker> in Nim
14:15:53FromDiscord<Gumbercules> so the number of lines of Nim is pretty asinine
14:16:26FromDiscord<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:36FromDiscord<Gumbercules> C code is very human readable
14:16:43FromDiscord<voidwalker> The one that Nim generates?
14:16:51FromDiscord<Gumbercules> yes
14:16:58FromDiscord<Gumbercules> it might not be pleasant but it's' definitely readable
14:17:29FromDiscord<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:30FromDiscord<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:39FromDiscord<Gumbercules> if I was in scientific computing or something, the story would probably be different
14:19:55FromDiscord<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:18FromDiscord<!!sharpcdf!!> This is coming out of nowhere, but I wonder if futhark can bind to lua
14:21:44FromDiscord<MagPhi> Which type system does nim have?
14:22:14FromDiscord<ringabout> In reply to @ratapenado "Hello, I remember a": The RFC was rejected.
14:23:53FromDiscord<ratapenado> @392962235737047041> @ringabout thanks for the answer
14:24:58FromDiscord<Gumbercules> In reply to @MagPhi "Which type system does": What do you mean? It's strongly and statically typed
14:25:31FromDiscord<Gumbercules> and it's a procedural and imperative language
14:25:41FromDiscord<MagPhi> In reply to @Gumbercules "What do you mean?": I asked what type system has been implemented in nim
14:26:48FromDiscord<Gumbercules> hopefully my answer was sufficient
14:28:09PMunch@MagPhi, but what do you mean by "what type system". It's not like the type systems have neatly defined names..
14:28:25PMunchNim also supports distinct types, which many other systems don't have. And it supports generics
14:30:01*arkurious joined #nim
14:30:16FromDiscord<MagPhi> In reply to @PMunch "<@695937684673134594>, but what do": yes they do
14:30:21FromDiscord<MagPhi> like Haskell has System F
14:30:38FromDiscord<MagPhi> (edit) "like Haskell ... has" added "and ML"
14:31:31FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=
14:31:53FromDiscord<MagPhi> why did you write the definition of System F?
14:32:00FromDiscord<Gumbercules> Because it's not a `type system`
14:32:33FromDiscord<Gumbercules> And Nim is not Haskell or ML or even close to either
14:33:06FromDiscord<Gumbercules> Nim does feature parametric polymorphism (as PMunch pointed out via the comment about supporting generics).
14:35:16FromDiscord<Gumbercules> If you're trying to compare Nim to languages slated for academia you're probably barking up the wrong tree
14:36:06FromDiscord<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:37PMunchTo 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:11FromDiscord<Gumbercules> Yeah, I just haven't found too many people ditching Haskell or ML for Nim.
14:40:41FromDiscord<Gumbercules> https://sr.ht/~duangle/scopes/ maybe
14:41:18FromDiscord<Gumbercules> https://call-cc.org/ maybe
14:42:39FromDiscord<Gumbercules> https://nim-lang.org/docs/manual.html#types
14:43:12FromDiscord<Gumbercules> I guess would be the best rundown of Nim's type system
14:44:35PMunchHmm, scopes looks interesting
14:46:52FromDiscord<Gumbercules> If you're really into type theory - https://www.idris-lang.org/ - has been doing quite a bit with dependent types
14:47:03FromDiscord<Gumbercules> I can't say much about the language other than that
14:48:25FromDiscord<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:15FromDiscord<Gumbercules> building the scopes project can be quite the PITA
14:49:24FromDiscord<deech> Yeah, from what I can tell Nim's type system is more C++ templates than ML.
14:53:06PMunchIt 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:12PMunchBut I can't seem to find it again
14:53:20PMunchMaybe it was a dream I had :P
14:56:33*pro joined #nim
14:57:28FromDiscord<ShalokShalom> In reply to @MagPhi "like Haskell and ML": Nope
14:57:48FromDiscord<ShalokShalom> Haskell started with System F and they went back to HM
14:57:59FromDiscord<ShalokShalom> ML was always HM
14:59:34FromDiscord<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:46FromDiscord<ShalokShalom> In reply to @PMunch "It really annoys me,": Was it hosted or compiled to machine code?
15:03:53FromDiscord<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:56FromDiscord<ShalokShalom> https://mobile.twitter.com/TimSweeneyEpic/status/1213814236184485889
15:04:22FromDiscord<deech> sent a long message, see https://paste.rs/y6B
15:04:50FromDiscord<deech> (edit) "https://paste.rs/l3X" => "http://ix.io/4gea"
15:05:12FromDiscord<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:21FromDiscord<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:57FromDiscord<deech> (edit) "signature. Basically" => "signature,"
15:06:15FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4geb
15:06:17FromDiscord<jmgomez> In reply to @deech "My biggest practical issue": I feel you, hopefully concepts (in both langs) will address it
15:06:55FromDiscord<ShalokShalom> And the safety guarantees are more worth than he gives them credit.
15:07:23FromDiscord<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:09FromDiscord<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:16FromDiscord<@thatrandomperson5-6310e3b26da03> How would i send a file as a response in jester?
15:10:35FromDiscord<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:56FromDiscord<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:13FromDiscord<ShalokShalom> I guess they assume, this goes against the imperative nature of the language
15:12:11FromDiscord<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:43FromDiscord<ShalokShalom> I assume, he doesnt really touch much code anymore, as most billionaire programmers.
15:13:13FromDiscord<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:07FromDiscord<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:35FromDiscord<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:10FromDiscord<pointystick> sent a code paste, see https://play.nim-lang.org/#ix=4gee
15:17:35FromDiscord<ShalokShalom> I dont doubt his earlier contributions
15:19:01FromDiscord<ShalokShalom> But I doubt he has done serious work in Rust
15:19:18FromDiscord<ShalokShalom> And lead projects across years
15:29:27FromDiscord<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:51FromDiscord<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:28FromDiscord<auxym> threading also seems to be sort of a mess atm.
15:44:23FromDiscord<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:13FromDiscord<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:07FromDiscord<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:21FromDiscord<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:31FromDiscord<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:45FromDiscord<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:26FromDiscord<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:28PMunch@ShalokShalom, compiled
16:07:35FromDiscord<@thatrandomperson5-6310e3b26da03> I donโ€™t need to download the files, i just need to serve the filesโ†ต(@pointystick)
16:08:11FromDiscord<@thatrandomperson5-6310e3b26da03> There is also apperntly an issue wih that https://forum.nim-lang.org/t/2596
16:10:20PMunch@thatrandomperson5-6310e3b26da03, that's a six year old issue, wouldn't be surprised if that was fixed by now
17:10:36NimEventerNew 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:43FromDiscord<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:33FromDiscord<Yardanico> In reply to @Jessa "is there a way": that will actually work, it's an implicit generic
17:43:36FromDiscord<Yardanico> but you can do explicit generics
17:43:47FromDiscord<Yardanico> `proc thing[T](myseq: seq[T]): T = stuff`
17:44:03FromDiscord<Jessa> In reply to @Yardanico "that will actually work,": it doesn't compile
17:44:37FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4geK
17:49:51FromDiscord<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:05FromDiscord<Jessa> oh
17:50:07FromDiscord<Jessa> oh my god
17:50:11FromDiscord<Jessa> I'm an idiot
17:50:38FromDiscord<EyeCon> Not at all, happens to everyone
17:50:58FromDiscord<Jessa> this just shows that 7 years of coding doesn't relief you from these problems
17:53:08deadmarshalHow 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:30FromDiscord<Phil> In reply to @deadmarshal "How can i make": Tried `{1..10}.toSeq`?
17:54:47FromDiscord<Phil> You wanted a sequence of a range right?
17:56:35deadmarshalLet me send the whole code, I'm not sure what is appropriate here: https://paste.c-net.org/CleggPerfect
17:57:44FromDiscord<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:12FromDiscord<Phil> and `n` is the number of elements in the list?
17:59:07deadmarshalNo, 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:54deadmarshalfor example if n = 5, list would be @[1,2,3,4,5]
18:00:03FromDiscord<Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=4geN
18:01:03FromDiscord<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:18FromDiscord<EyeCon> In reply to @deadmarshal "Let me send the": Note that you are not checking the unpermuted seq
18:02:56deadmarshalYes u are right about permutations
18:03:16FromDiscord<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:17deadmarshalEyecon: oh you are right
18:03:31FromDiscord<Phil> Since so far you're only generating that one in order of the range
18:03:58deadmarshalPhil: Doesn't that nextPermutation give me all permutations? :D
18:04:11FromDiscord<Phil> Good question, let me check that proc, never used it
18:04:18FromDiscord<EyeCon> Somewhat cleaned-up version: https://play.nim-lang.org/#ix=4geR
18:04:34FromDiscord<EyeCon> In reply to @deadmarshal "<@180601887916163073>: Doesn't that nextPermutation": It does, provided that you start with a sorted seq
18:04:58FromDiscord<Phil> Which he would given that he's instantiating from a range
18:05:03FromDiscord<EyeCon> Yes
18:05:39deadmarshalThank you that works.
18:05:57deadmarshalWhat is the difference of using () and {} before toSeq?
18:06:42FromDiscord<Phil> They should actually do the same in my eyes, toSeq(range) is just more normal syntax
18:07:26deadmarshalPerhaps that isCute function can be done with any too :D
18:07:27FromDiscord<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:41FromDiscord<Phil> (edit) "`(toSeq({1..10})`" => "`toSeq({1..10})`"
18:07:41deadmarshali mean "any" function
18:07:58FromDiscord<Phil> You wanted to get the number of cute permutations right?
18:08:04FromDiscord<Phil> Or did you want to check if any of the permutations are cute?
18:08:06deadmarshalYep
18:08:22FromDiscord<Phil> In that case "any" won't help you as that'll stop after finding the first cute permutation
18:08:27deadmarshalthe number
18:09:15FromDiscord<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:18deadmarshalNo i mean using any on each element, instead of the for loop in iscute func
18:10:00FromDiscord<Phil> does `element` refer to each individual seq that represents a permutation fo the original one?
18:10:02FromDiscord<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:04deadmarshalYes, that is probably the reason for nextPermutation and not Permutations
18:10:29deadmarshalby element i meant an int
18:10:30FromDiscord<Phil> Ohhh you were in the loop in "isCute"
18:10:45deadmarshalyep EyeCon is right
18:10:57FromDiscord<Phil> I was mentally in the while loop that uses the isCute function
18:11:06FromDiscord<Phil> And I was like "how does any help you there in any capacity?"
18:11:22FromDiscord<Phil> God damn my brain is just so damn tired
18:11:45deadmarshalnp, thanks y'all
18:12:50FromDiscord<EyeCon> https://play.nim-lang.org/#ix=4geU
18:13:58deadmarshalawesome
18:40:50FromDiscord<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:10FromDiscord<Gumbercules> plugins (including game code) get compiled to a shared library and loaded / reloaded at runtime
18:49:06FromDiscord<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:38FromDiscord<jmgomez> (edit) removed "a" | "library," => "libraries,"
18:50:25FromDiscord<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:52FromDiscord<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:19FromDiscord<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:49FromDiscord<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:42FromDiscord<jmgomez> We pass some info between the libraries also with it
18:58:43FromDiscord<ShalokShalom> In reply to @jmgomez "Mostly agree. Maybe I": Inference? Type inference you mean?
18:58:54FromDiscord<jmgomez> yup
19:00:14FromDiscord<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:48FromDiscord<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:09FromDiscord<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:40FromDiscord<ShalokShalom> I am a big sucker for type inference
19:03:00FromDiscord<ShalokShalom> Nim has a type system, that does make type inference very hard
19:03:12FromDiscord<ShalokShalom> To the degree I am used to.
19:04:20FromDiscord<jmgomez> yeah, I like it too. And formal stuff. But what I appreciate from Nim is practicality
19:04:34FromDiscord<xixixi> is there documentation grouped by the type of the proc first parameter?
19:04:52FromDiscord<xixixi> as in all available operations on strings, seqs, etc?
19:07:37FromDiscord<jmgomez> I dont think there is
19:18:15FromDiscord<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:29FromDiscord<ShalokShalom> He made a very clear statement, that this is not going to happen
19:18:44FromDiscord<ShalokShalom> Some curse word and 'lazy' was part of the content.
19:19:13FromDiscord<jmgomez> hmm probably due to some design decision I guess
19:19:21FromDiscord<ShalokShalom> In reply to @jmgomez "yeah, I like it": Yes, its a very straight forward language
19:19:26FromDiscord<ShalokShalom> Unless, it isnt
19:19:42FromDiscord<ShalokShalom> In reply to @jmgomez "hmm probably due to": I understand it, when its for top level definitions
19:20:09FromDiscord<ShalokShalom> Even F# recommends it for those, and there is no language that uses type inference so widely.
19:20:21FromDiscord<ShalokShalom> It makes total sense, to enforce them there
19:20:35FromDiscord<ShalokShalom> But even that could do the editor for you
19:20:42FromDiscord<ShalokShalom> Based on the type inference of Nim
19:21:07FromDiscord<ShalokShalom> Idk about the complexity of a type inference system for a language like Nim
19:21:37FromDiscord<ShalokShalom> But for a functional language is Nims type system strictly not suitable, for complete inference
19:22:07FromDiscord<ShalokShalom> And as I had been told, is Nims type system more.. Well lets say patched together
19:23:37FromDiscord<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:06FromDiscord<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:01FromDiscord<ShalokShalom> Sure, you could improve it
19:28:24FromDiscord<ShalokShalom> But for type inference, you dont need to figure out only the proc or func at hand
19:28:33FromDiscord<ShalokShalom> It flows through your whole code
19:28:45FromDiscord<ShalokShalom> And I have seen other languages struggle with that
19:28:52FromDiscord<ShalokShalom> Namely Haskell, Scala, F#
19:29:05FromDiscord<ShalokShalom> And they all have a vastly superior type system
19:29:27FromDiscord<ShalokShalom> It might be, that Nims structures are that much easier to infer
19:29:30FromDiscord<ShalokShalom> But I doubt it.
19:33:55FromDiscord<jmgomez> my point is that IMO it shouldnt be a priority even if I like it.. although my opinion doesnt really matter ๐Ÿ˜›
19:48:07FromDiscord<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:29FromDiscord<ShalokShalom> Yes
19:49:03FromDiscord<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:07FromDiscord<guttural666> okay
19:49:45FromDiscord<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:56FromDiscord<guttural666> think I'm gonna stick to that
19:54:14FromDiscord<ShalokShalom> Well, sometimes you create complex types
19:54:21FromDiscord<ShalokShalom> Who all work into each other
19:54:32FromDiscord<ShalokShalom> And then you form the basement of your app on it
19:54:43FromDiscord<ShalokShalom> I think it makes sense to put them at the top
19:55:05FromDiscord<ShalokShalom> And then, when needed, create some smaller, more specific type definitons, where you need them
19:56:08FromDiscord<ShalokShalom> Like you can see in this example:โ†ตโ†ตhttps://github.com/thedevaspect/aspect-fsharp/blob/master/Game.fs
19:57:08FromDiscord<ShalokShalom> The main types at the top and then a few one down the line.
19:58:40FromDiscord<guttural666> "the basement of your app" ๐Ÿ˜„ that's a new one
19:58:45FromDiscord<guttural666> yeah, does make sense
20:04:23FromDiscord<ShalokShalom> Oh, sorry. ๐Ÿ˜…
20:04:42FromDiscord<ShalokShalom> My broken English. The basis ofc
20:05:44FromDiscord<guttural666> I study broken English, being employed in German industry hahaha
20:07:40FromDiscord<ShalokShalom> Haha. I am German, at least theoretically
20:08:01FromDiscord<ShalokShalom> Born in Austria, and currently living in Germany half the time.
20:08:12FromDiscord<guttural666> I remember ๐Ÿ™‚
20:12:39*LuxuryMode quit (Quit: Connection closed for inactivity)
20:13:06FromDiscord<Tuatarian> if I have a object variant/variant adt/whatever it's called
20:13:11FromDiscord<Tuatarian> and I change the discriminator
20:13:25FromDiscord<Tuatarian> do things associated to the variant it previously was get dealloced?
20:16:40FromDiscord<Tuatarian> ok it seems it's not relevant since objects can't dynamically change their branch
20:16:58FromDiscord<Tuatarian> so the entire previous thing will be freed when we run out of scope
20:20:17FromDiscord<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:22FromDiscord<Tuatarian> so this is not a concern
21:12:54*derpydoo quit (Ping timeout: 256 seconds)
21:22:12FromDiscord<Elegantbeef> An alias can be done `type MyArray = array[10, int]`
21:27:14FromDiscord<Tuatarian> why is this failing to compile?
21:27:23FromDiscord<Tuatarian> gives error
21:27:25FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfH
21:27:57FromDiscord<Tuatarian> https://play.nim-lang.org/#ix=4gfG
21:27:59FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfI
21:29:33FromDiscord<Elegantbeef> `when b is int`
21:30:37FromDiscord<Tuatarian> why does if not work?
21:30:41*Phytolizer joined #nim
21:30:45FromDiscord<Elegantbeef> If is runtime
21:31:05FromDiscord<Tuatarian> oh and the return type must be known at comptime
21:31:06FromDiscord<Tuatarian> right
21:31:18FromDiscord<Tuatarian> even if it's untyped, the expr should have a type at comptime
21:31:19FromDiscord<Tuatarian> right?
21:31:38FromDiscord<Elegantbeef> Each branch of an if expression has to be typed the same
21:32:05FromDiscord<Elegantbeef> in this case you have `ival: float`
21:32:16FromDiscord<Elegantbeef> \and also all branches have to compile
21:32:34FromDiscord<Elegantbeef> when only compiles true branches
21:32:37FromDiscord<Elegantbeef> if compiles all branches
21:33:12FromDiscord<Tuatarian> oh i see
21:33:33FromDiscord<Tuatarian> so it would compile an invalid expression there in the top line if b is float
21:33:39FromDiscord<Tuatarian> but why did ints work?
21:33:47FromDiscord<Tuatarian> if I put an int there instead of a float, that worked fine
21:33:57FromDiscord<Elegantbeef> It doesnt work fine
21:34:10FromDiscord<Elegantbeef> `echo makenum(int(3))`
21:34:21FromDiscord<Elegantbeef> `3` is a untyped literal
21:34:36FromDiscord<Elegantbeef> it can be converted to any numeric type
21:34:49FromDiscord<Tuatarian> is `3` not an int literal?
21:34:54FromDiscord<Elegantbeef> Nope
21:34:58FromDiscord<Tuatarian> oh I see
21:35:01FromDiscord<Elegantbeef> It's an untyped literal
21:35:08FromDiscord<Tuatarian> and it gets converted as needed
21:35:24FromDiscord<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:57FromDiscord<Elegantbeef> `toOpenArray` has always worked in place of `[a..b]` for passing to `openArray`
21:35:59FromDiscord<Elegantbeef> You cannot hold onto it
21:36:05FromDiscord<.tochka> it works without experimental if you dont save them to objects
21:36:06FromDiscord<Elegantbeef> you need views to hold onto it
21:38:22FromDiscord<Tuatarian> now I'm getting another odd issue
21:38:24FromDiscord<Tuatarian> ` if a.isInt: return makenum(-a.iVal)`
21:38:27FromDiscord<Tuatarian> doesn't compile
21:38:37FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=
21:39:14FromDiscord<Tuatarian> really no idea why this would be happening, there's nothing too weird here
21:40:10FromDiscord<Elegantbeef> the other branch likely has an expression
21:40:59FromDiscord<Tuatarian> full function is
21:41:12FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfM
21:43:37FromDiscord<Tuatarian> that's the whole function
21:43:49FromDiscord<Tuatarian> oh this should be a when
21:44:20FromDiscord<Tuatarian> no, if I change it to when it says it cannot evaluate it at comptime
21:46:36FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gfO
21:47:15FromDiscord<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:46FromDiscord<voidwalker> deleted the bencode.nim from the folder, now it says it cannot open `path_to_project/bencode.nim [IOError]`
21:55:25FromDiscord<voidwalker> why does it look for it there, if I have import ? :\
21:57:10*Phytolizer quit (Quit: Client closed)
22:03:58FromDiscord<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:17FromDiscord<Tuatarian> In reply to @Elegantbeef "the other branch likely": tbh lmao I still have no idea what was causing that
22:07:27FromDiscord<Tuatarian> haven't fixed it yet, guess I'll just work around it for the time being
22:08:49FromDiscord<Tuatarian> rewriting the to remove the else branch and not use makenum causes the same error
22:10:18FromDiscord<Tuatarian> issue I think is that compiler can't verify that `a.iVal` is a legal call
22:11:03FromDiscord<Tuatarian> since only one of the object variants has an `iVal` field, general `HvNum` doesn't have it (obviously)
22:11:19FromDiscord<Tuatarian> I feel like there should be a reasonable way to do this though
22:13:36FromDiscord<dizzyliam [they/them]> Can procs from `system/nimscript` be used inside a macro?
22:15:21FromDiscord<Tuatarian> this kinda feels like a bad implementation of obj variants ngl
22:15:29FromDiscord<Tuatarian> there has to be a good way to do the thing I'm trying to do above
22:15:39FromDiscord<Tuatarian> but it's not clear at all and idk where to find proper docs/info regarding this kind of thing
22:16:58FromDiscord<guttural666> any way to make the element mutable in a for loop? https://media.discordapp.net/attachments/371759389889003532/1043288732826083388/image.png
22:18:59FromDiscord<Generic> use the mitems iterator
22:23:55FromDiscord<guttural666> can you help me out, how would I invoke that iterator?
22:26:10FromDiscord<dizzyliam [they/them]> `for counter in flag_set_counter.mitems:`
22:28:09FromDiscord<guttural666> yeah, just read it, thanks!
22:28:27FromDiscord<guttural666> and without the .mitems that would default to the immutable iterator
22:28:34FromDiscord<guttural666> read only
22:29:16FromDiscord<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:36FromDiscord<xixixi> (edit) "ans" => "and"
22:29:45FromDiscord<guttural666> do you ppl omit the () in a call like that? think it's too easily confused with a field access
22:30:03FromDiscord<dizzyliam [they/them]> it's a readability thing for me
22:30:03FromDiscord<Tuatarian> I do much of the time
22:30:20FromDiscord<Tuatarian> usually the name is enough to tell you what the function does
22:30:33FromDiscord<guttural666> yeah probably true
22:30:34FromDiscord<Tuatarian> and you'll know whether it's a field access or call from that
22:31:17FromDiscord<guttural666> think I prefer to always use () for function calls tho
22:31:41FromDiscord<guttural666> don't have to think as much then
22:31:49FromDiscord<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:08FromDiscord<guttural666> yeah yeah, that does make sense
22:32:32FromDiscord<dizzyliam [they/them]> a pseudo-field :)
22:32:45FromDiscord<guttural666> don't get me started about getters
22:32:55FromDiscord<Tuatarian> I do this too, I also used to abuse `.` notation but I've reigned myself in a little bit
22:33:25FromDiscord<guttural666> what would you consider abusing .?
22:34:25FromDiscord<guttural666> i tend to stick to the thing.do_smth_with_the_thing(you'll need this) notation, quite like that
22:35:43FromDiscord<guttural666> though echo "pls" is just so nice
22:38:45FromDiscord<dizzyliam [they/them]> That calling convention can combine with well chosen identifiers to make things read like english instructions, which is nice
22:38:51FromDiscord<dizzyliam [they/them]> `serve app`
22:38:58FromDiscord<dizzyliam [they/them]> `exec command`
22:38:59FromDiscord<guttural666> yeah, that's really neat
22:39:00FromDiscord<dizzyliam [they/them]> etc
22:39:36FromDiscord<guttural666> bit foreign at first, coming from c-style languages
22:40:16FromDiscord<guttural666> i'm still a bit all over the place with my function calls, not really decided on what's best
22:44:14FromDiscord<Tuatarian> In reply to @guttural666 "what would you consider": I once wrote `60.SetTargetFps` without thinking
22:44:26FromDiscord<Tuatarian> and then someone pointed it out to me
22:44:29FromDiscord<Tuatarian> and I was like yeah
22:44:30FromDiscord<.tochka> hm, how to have nim object definition that is compatible with c struct one?
22:44:46FromDiscord<Generic> {.pure.}
22:44:52FromDiscord<Generic> I think
22:46:13FromDiscord<Elegantbeef> Yea that strips the type information
22:47:13FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gfZ
22:47:47FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4gg0
22:49:10FromDiscord<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:19FromDiscord<.tochka> so, c2nim doesnt generate c compatible typedefs
22:49:31FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4gg1
22:49:43FromDiscord<DarkSky> (edit) "https://play.nim-lang.org/#ix=4gg1" => "https://play.nim-lang.org/#ix=4gg2"
22:49:50FromDiscord<Elegantbeef> `for x in 0..10:`
22:49:58FromDiscord<DarkSky> thxx
22:50:21FromDiscord<.tochka> In reply to @DarkSky "whats the equivalent of": for i in 0..9: echo "hello world"
22:50:22FromDiscord<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:08FromDiscord<Elegantbeef> Tochka `type A = object` doesnt have type information
22:51:37FromDiscord<Elegantbeef> Or atleast it shouldnt
22:52:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg3
22:52:21FromDiscord<Elegantbeef> Only inheritance types have type information
22:52:31FromDiscord<.tochka> i was talking about binary compatibility
22:52:54FromDiscord<Elegantbeef> Nim objects are binary compatible with C structs
22:53:15FromDiscord<.tochka> so, ordering of fields matter?
22:53:44FromDiscord<.tochka> no alignment optimizing ๐Ÿ˜”
22:54:06FromDiscord<.tochka> ye i guess issue was that enums that were spitted by c2nim weren't sizeof cint
22:54:09FromDiscord<dizzyliam [they/them]> In reply to @.tochka "for i in 0..9:": Or slightly more readable IMO `for i in 0..<10`
22:54:36FromDiscord<Elegantbeef> `{.packed.}` if you want it packed
22:54:39FromDiscord<Elegantbeef> `{.align` if you want to handle that
22:54:41FromDiscord<Elegantbeef> It's actually nice that it doesnt do optimisations ime when dealing with opengl and the like
22:55:40FromDiscord<.tochka> i kinda prefer zig way, where you can add packed and export modifiers, but by default reordering is allowed
22:57:23FromDiscord<Elegantbeef> Yea it'd be nice to have the compiler to reorder it the best
22:57:49FromDiscord<Elegantbeef> I suppose a macro could do that, but i dont know the alignment rules so cannot say much
22:58:12FromDiscord<Elegantbeef> I was meaning on making a macro to reorder to 16bytes for opengl
22:58:25FromDiscord<.tochka> probably side effect of nim compiler not knowing what c compiler will do
22:58:43FromDiscord<Elegantbeef> Eh `sizeof` is a magic and doesnt rely on the C compiler
22:59:04FromDiscord<Elegantbeef> Well i should say it doesnt rely on the C compiler for Nim created types ๐Ÿ˜„
22:59:11FromDiscord<Elegantbeef> same for `offsetOF`
22:59:32FromDiscord<.tochka> then its probably a solved issue, hm
22:59:54FromDiscord<Elegantbeef> To reply, I dont really know what to say, is it possibly an issue with the library you're usingโ†ต(@voidwalker)
23:01:15FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/sizealignoffsetimpl.nim
23:01:49FromDiscord<Elegantbeef> 100% undocumented cause you're supposed to know how this all behaves ๐Ÿ˜„
23:03:10FromDiscord<.tochka> hm, if you try to make reordering macro, you wouldn't know the sizes of generic fields at macro expansion right?
23:05:31FromDiscord<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:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg6
23:07:56FromDiscord<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:21FromDiscord<Elegantbeef> Make a constructor
23:09:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gg7
23:09:57FromDiscord<guttural666> hmmmm
23:10:28FromDiscord<Elegantbeef> Never use `new` for a `object` only use it for a `ref`
23:10:28FromDiscord<Elegantbeef> In Nim `new` has the semantic it's heap allocated
23:10:29FromDiscord<guttural666> _: is unnamed?
23:10:47FromDiscord<Elegantbeef> `_` means you dont care about the variable and Nim prevents you from accessing it
23:10:48FromDiscord<guttural666> ref would be heap allocated automatically?
23:10:55FromDiscord<guttural666> very nice
23:10:56FromDiscord<Elegantbeef> "automatically"
23:11:17FromDiscord<Elegantbeef> ref isnt heap allocated automatically, refs are heap allocated types
23:11:37FromDiscord<Elegantbeef> `var a: ref int; assert a.isNil`
23:12:03FromDiscord<guttural666> that's what I meant
23:12:53FromDiscord<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:58FromDiscord<guttural666> thanks Elegant
23:13:51FromDiscord<guttural666> would have expected some sort of type deduction when adding something to a seq tho
23:14:11FromDiscord<Elegantbeef> Nim only does local inference which means right to left
23:14:41FromDiscord<Elegantbeef> Also that's a weird specialisation of a object constructor that only works in dispatch
23:14:41FromDiscord<guttural666> got it
23:14:52FromDiscord<Elegantbeef> As if procedure dispatch isnt already very complicated
23:16:20FromDiscord<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:41FromDiscord<Tuatarian> Beef do you have a potential solution to the problem I had above?
23:49:02FromDiscord<Tuatarian> 8m not home at the moment but I'm curious how your get around that
23:50:05FromDiscord<Elegantbeef> Which issue?
23:51:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggd
23:54:37FromDiscord<Tuatarian> Really?
23:54:43FromDiscord<Tuatarian> It wasn't compiling for me...
23:54:50FromDiscord<Elegantbeef> Would i lie to you?
23:54:52FromDiscord<Tuatarian> Wonder if I accidentally did something strange
23:54:57FromDiscord<Tuatarian> No lmao I'm just confused
23:55:32FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gge
23:56:15FromDiscord<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