<< 17-11-2023 >>

00:18:41*rockcavera quit (Remote host closed the connection)
00:25:07*rockcavera joined #nim
00:40:40*lucasta joined #nim
00:51:13FromDiscord<bootymonster69> sent a code paste, see https://play.nim-lang.org/#ix=4LHZ
00:52:10FromDiscord<bootymonster69> (edit) "https://play.nim-lang.org/#ix=4LHZ" => "https://play.nim-lang.org/#ix=4LI0"
00:52:37FromDiscord<bootymonster69> (edit) "https://play.nim-lang.org/#ix=4LI0" => "https://play.nim-lang.org/#ix=4LI2"
01:05:34FromDiscord<Elegantbeef> It means it can take a typedescription or a value
01:05:39FromDiscord<Elegantbeef> it's an older way for `typedesc[array]`
01:05:56FromDiscord<Elegantbeef> This means you can do `array[10,int].len` and `[1, 2, 3, 4].len`
01:06:16*krux02 quit (Remote host closed the connection)
01:10:08FromDiscord<Elegantbeef> Nim typeclasses are just constraints on procedures unlike other languages
01:10:19FromDiscord<Elegantbeef> @bootymonster69
01:10:52*oz quit (Server closed connection)
01:11:07*ox joined #nim
01:19:36FromDiscord<bootymonster69> thank you!
01:22:44FromDiscord<bootymonster69> is there a way to allow a proc param to accept any value whose type is derived from a specified type?
01:23:27FromDiscord<bootymonster69> in GO, if the specified type is `int`, then this would be expressed as `~int` in the type constraint signature
01:23:59FromDiscord<bootymonster69> so it would accept an int, and any distinct ints
01:24:54FromDiscord<Elegantbeef> For inhertiance you can do `proc doThing(_: Base)` if you do not care about the exact type, or `proc doThing[T: Base](_: T)` if you do care about the exact sub type
01:25:46FromDiscord<bostonboston> I was going to say `SomeInteger` but I don't know if that's what you're looking for
01:25:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LI9
01:26:00FromDiscord<eszettera> guys
01:26:10FromDiscord<eszettera> how do i keep track of active connections on a socket
01:26:29FromDiscord<eszettera> im too dumb
01:26:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LIa
01:27:00FromDiscord<bootymonster69> In reply to @bostonboston "I was going to": I saw that but I don't think it would include distinct types
01:27:13FromDiscord<Elegantbeef> It does not it is a typeclass for all builtin integers
01:27:13FromDiscord<bootymonster69> In reply to @Elegantbeef "For distincts you": Nim has concepts?
01:27:21FromDiscord<Elegantbeef> Yes they're experimental
01:28:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LIb
01:30:09FromDiscord<Elegantbeef> Many ways to skin a marsupial
01:30:34FromDiscord<bostonboston> Is that how it goes
01:31:56FromDiscord<Elegantbeef> No
01:32:13FromDiscord<Elegantbeef> The talk about skinning cats is too common, time to move to other mammals
01:32:37FromDiscord<bootymonster69> thank you I will ponder these. for shits and giggles, I was attempting to create a function that returned a new type
01:32:59FromDiscord<Elegantbeef> In what way?
01:34:02FromDiscord<bootymonster69> nim's generic type syntax is nice but I saw how Zig does their's and I thought I would see if Nim would let me express generics in that way, given that Nim has so many ways to express the same thing as part of its design
01:34:17FromDiscord<bootymonster69> (edit) "their's" => "theirs"
01:34:36FromDiscord<Elegantbeef> It does
01:35:17FromDiscord<bootymonster69> sent a code paste, see https://play.nim-lang.org/#ix=4LIc
01:37:29FromDiscord<bootymonster69> sent a code paste, see https://play.nim-lang.org/#ix=4LIe
01:37:52FromDiscord<Elegantbeef> Right Nim does not have anonymous types
01:37:55FromDiscord<Elegantbeef> So that's not valid
01:38:21FromDiscord<bootymonster69> surprisingly, it does seem to compile...
01:39:03FromDiscord<bootymonster69> (edit) "https://play.nim-lang.org/#ix=4LIe" => "https://paste.rs/4qWi1"
01:39:07FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/0tPuT
01:39:16FromDiscord<bootymonster69> crazy
01:39:34FromDiscord<Elegantbeef> Not that this makes any sense as you know 😄
01:39:46FromDiscord<Elegantbeef> `type FList[Size: static int; T]` makes a whole lot more sense
01:40:24FromDiscord<bootymonster69> it does make a whole lot more sense. I was just seeing how far nim would let me take it
01:40:31FromDiscord<bootymonster69> its... really tolerant
01:40:48FromDiscord<bootymonster69> whatever the opposite of opinionated is
01:41:01FromDiscord<bootymonster69> most IDGAF language
01:41:49FromDiscord<Elegantbeef> Flexible
01:42:07FromDiscord<bootymonster69> In reply to @bootymonster69 "surprisingly, it does seem": I lied. I forgot to save the doc before compiling
01:42:18FromDiscord<bootymonster69> does not compile
01:42:24FromDiscord<Elegantbeef> It's an extremely extensible language with tonnes of user fondness
01:42:30FromDiscord<Elegantbeef> Yea It won't even parse never mine semantically check
01:43:14FromDiscord<bootymonster69> it was fun to think through tho
01:43:17FromDiscord<bootymonster69> thank you!
01:44:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LIf
01:44:50FromDiscord<Elegantbeef> I also did not realise that Go took the 'distinct' concept from Oberon
01:45:05FromDiscord<Elegantbeef> How does one define a distinct type in Go?
01:45:29FromDiscord<bootymonster69> all types you define as another type are distinct
01:46:58FromDiscord<bootymonster69> sent a code paste, see https://play.nim-lang.org/#ix=4LIg
01:47:59FromDiscord<bootymonster69> MyInt does not alias int, its another thing entirely and I will need to cast it back if i want to use it as an int, unless I'm using type constraints in all of my func signatures
01:48:57FromDiscord<Elegantbeef> No type aliases, shame
01:49:29FromDiscord<Elegantbeef> But anyway cool to see other places have distinct types
02:13:32*Onionhammer quit (Server closed connection)
02:13:47*Onionhammer joined #nim
02:36:42*lucasta quit (Remote host closed the connection)
03:03:19*NimEventer quit (Server closed connection)
03:03:31*NimEventer joined #nim
04:14:31*rockcavera quit (Remote host closed the connection)
05:36:59*dv^_^ quit (Server closed connection)
05:37:27*dv^_^ joined #nim
06:29:44*mal`` quit (Quit: Leaving)
06:42:06*notchris quit (Server closed connection)
06:42:15*notchris joined #nim
06:46:49*mal`` joined #nim
06:48:01*advesperacit joined #nim
07:18:49*PMunch joined #nim
07:33:59*redj quit (Quit: No Ping reply in 180 seconds.)
07:35:31*redj joined #nim
08:04:16om3gaI have again tables related question. How called this default sorting order for Table?:
08:04:21om3gahttps://play.nim-lang.org/#ix=4LJn
08:05:02om3gaand maybe anyone knows why it made like that
08:05:15om3gawhat can be the reason for it?
08:07:24FromDiscord<Elegantbeef> `Table` is an unordered table, as such the order is dependant on the hashcode
08:07:53FromDiscord<Elegantbeef> If you want to care about insertion order use a OrderedTable
08:08:20om3gaI understand, but if we run it twice, it prints the same output
08:09:05om3gawhat means it has some logic in which order add data in table
08:09:17FromDiscord<Elegantbeef> It uses the hash of the key
08:09:26FromDiscord<Elegantbeef> As such it's deterministic so the order is maintained
08:09:53om3gahmm, so if I use int as key, it will convert it to hash?
08:10:08FromDiscord<Elegantbeef> Yes it hashes it
08:10:18FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4LJo is a way to make it ordered ordinally
08:11:59om3gaElegantbeef, hmm, interesting!
08:12:12om3gabut how it manages to hash key value so fast?
08:12:56FromDiscord<nnsee> why don't the hashes here make sense?↵↵https://play.nim-lang.org/#ix=4LJq
08:15:52FromDiscord<Elegantbeef> What doesn't make sense about it?
08:16:47FromDiscord<nnsee> they don't seem ordered in any immediately obvious way either
08:16:49FromDiscord<demotomohiro> Table uses hash func to get a random value from key, so that even if keys that are different but similar bit pattern is given, hash collision rarely happen.
08:17:14FromDiscord<nnsee> unless i'm using hash wrong in the first place
08:18:19Amun-Rannsee: you mean hash values ordered?
08:19:51FromDiscord<Elegantbeef> https://nim-lang.org/docs/hashes.html#hashWangYi1
08:22:19FromDiscord<demotomohiro> iirc, when size of internel storage is 2^N, lowest N bits of hash are used to pick first slot.↵If that slot is used, another random slot is picked.
08:24:59*NimBot quit (Server closed connection)
08:25:11*NimBot joined #nim
08:31:37om3gabut collision can happen right?
08:32:40om3gathat makes Tables dangerous for grouping parts of some sequence by specific key
08:38:05*sagax joined #nim
08:45:22FromDiscord<demotomohiro> Collision can happen in any keys. But hash function in stdlib should good enough and many collisions should not happens from sequential int values.
08:48:40*mahlon quit (Server closed connection)
08:49:19*mahlon joined #nim
08:50:29Amun-Racollisions are not dangerous, they just extend time
09:10:39*bcksl quit (Server closed connection)
09:11:05om3gademotomohiro, I mean if we use real key value, collision will happen if key is the same
09:11:37om3gabut with hashes we can get false positive collision
09:12:14om3gaso that's strange why tables module don't have option for this. Probably I will submit FR
09:13:50FromDiscord<nnsee> isn't a hash collision incredibly unlikely? like, you-will-probably-run-out-of-memory-before-that-happens unlikely?
09:14:02*bcksl joined #nim
09:16:02om3gawell... if something can happen, it will happen some day. That's what my lecturer told us back in uiniversity days
09:20:11*tk quit (Server closed connection)
09:20:19*tk joined #nim
09:32:13FromDiscord<demotomohiro> sent a long message, see http://ix.io/4LJS
09:36:23om3gademotomohiro, I understand. but when different keys will make same hashes, this is not what we want
09:36:56om3gawe will get in this case keyExists error
09:38:01om3gathat's why I'm saying, optional parameter for table will be helpful, which will disable hash generation
09:38:31om3gaand table will use real key value for storing in table
09:44:26FromDiscord<demotomohiro> Do you want to avoid any slow down caused by hash collision?↵Even if hash generation is stopped and use int key as is, collision can happens when there are 2 keys having same bits in low bits and only higher bits are different.
09:45:24om3gabut why not to store key as it is?
09:46:11om3gaeven if this will be slow, it's only 8 bytes
09:46:46FromDiscord<Elegantbeef> Cause what if you have a large object
09:46:55FromDiscord<Elegantbeef> I mean it does store the key as is, but the hash is for indexing
09:48:16om3gahmm, then seems I don't understand something
09:48:37om3gahashes are for sorting?
09:48:40FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/issues/13393
09:48:45FromDiscord<Elegantbeef> No
09:48:50FromDiscord<Elegantbeef> Hashes are for indexing and that's it
09:49:23om3gaindexing keys for hasKey?
09:49:50om3gasorry, code a bit large, I can't read it fast now
09:50:24om3gaor for contains?
09:50:32FromDiscord<Elegantbeef> `Table`s are not sortable
09:50:32FromDiscord<Elegantbeef> They do not keep track of the insertion order as such they cannot be sorted.
09:51:05FromDiscord<Elegantbeef> Contains is just indexing
09:54:14om3gaaha, so hasKey will not use hash indexes, but will verify real int value or string, or whatever
09:55:09om3gathen I don't really understand how indexes hash collisions will affect functionality
09:55:43om3gaI assume the order during printout will be affected? or `contains`?
09:57:10FromDiscord<Elegantbeef> hash collision is an issue cause if two keys produce the same hash you get more comparisons
09:59:07om3gaah, so it will not ruin process of storing or finding the key
09:59:08om3gathanks
09:59:26om3gaso it's made for speedup
10:00:09om3gaand printout of table contents depends on indexes, and not on real key values
10:02:45FromDiscord<Elegantbeef> The hash is a much cheaper comparison of values than checking if two keys indeed match
10:02:45FromDiscord<Elegantbeef> Atleast on larger types
10:02:49FromDiscord<Elegantbeef> The hash also does give you the index or a possible index to look at iirc
10:02:52FromDiscord<Elegantbeef> Right iterating the table iterates the data and nothing else
10:02:53FromDiscord<Elegantbeef> Hence why my distinct worked
10:02:53FromDiscord<Elegantbeef> It tricked the indexing to move everything into ordinal order
10:03:40om3gayeah, it's very helpful
10:04:15om3gathanks Elegantbeef, demotomohiro for explanation
10:05:09FromDiscord<Elegantbeef> With a perfect hash function you of course do not need to check the key, but alas we only have limited bits
10:48:10FromDiscord<narimiran> sent a long message, see https://paste.rs/NF7ni
10:48:21NimEventerNew thread by miran: Nim Community Survey 2023, see https://forum.nim-lang.org/t/10645
11:06:40FromDiscord<nnsee> was there no survey last year?
11:06:47FromDiscord<nnsee> the blog post only lists up to 2021
11:06:49FromDiscord<odexine> I think
11:07:00FromDiscord<odexine> Wait no I’m pretty sure there was last year
11:09:47PMunchNo last year was missed
11:09:49PMunchNot sure why
11:12:39FromDiscord<narimiran> You guys didn't see (post) Covid memes? Year 2022 didn't exist!
11:14:38FromDiscord<nnsee> woah, from 2021 results, it seems like nim is only half as popular in the US than in europe
11:14:44FromDiscord<nnsee> that sort of surprises me
11:18:48FromDiscord<odexine> Not really, Nim just has poor advertising and also is a bit controversial at first glance
11:18:54FromDiscord<odexine> Cough insensitivity cough
11:36:47PMunchWe're insensitive to coughing?
11:39:04FromDiscord<odexine> No, syntax, I mean style insensitivity
11:39:19FromDiscord<myxi> well i enjoy that feature
11:39:33FromDiscord<odexine> But there is also that with regards to how Araq was before, even if it is merely just before it still does have an effect
11:39:46FromDiscord<odexine> In reply to @myxi "well i enjoy that": A good amount of people have a knee jerk reaction to it
11:39:51PMunchodexine, I was just joking :P
11:40:38FromDiscord<odexine> I know but I wanted to be serious about it anyway
11:41:40FromDiscord<myxi> In reply to @odexine "A good amount of": well yeah it has its potential for some obscure bugs, but with great power comes great responsibility 🙃
11:43:06FromDiscord<odexine> NGL after using elixir which has something similar to UFCS I think I prefer how elixir does it
11:43:34FromDiscord<odexine> In terms of UFCS, sorry that was a bit sudden of a change of topic
11:44:26FromDiscord<Phil> In reply to @PMunch "We're insensitive to coughing?": I am, whenever I notice somebody coughing I open up my relentless book of bullying remarks
11:45:19PMunchmyxi, well I'd almost say that not having it would cause more bugs
11:45:42PMunchIf you have a super_variable and superVariable and you use the wrong one in the wrong place
11:45:58PMunchodexine, how does elixir to UFCS?
11:46:19FromDiscord<odexine> They have this operator which I don’t know the name of with this syntax
11:46:23FromDiscord<nnsee> basically pipes iirc
11:46:26PMunchPhil, now my brain is just stuck trying to find insults for coughing people :P
11:46:26FromDiscord<odexine> Yeah
11:46:47FromDiscord<odexine> firstparam |> function(second, third, ...)
11:46:59FromDiscord<odexine> Benefit of it is that the function can be qualified
11:48:09FromDiscord<Phil> In reply to @PMunch "<@180601887916163073>, now my brain": Get rid of that fermented sludge elsewhere
11:48:09FromDiscord<nnsee> In reply to @odexine "firstparam |> function(second, third,": ah yes, the Bird Peeking Around Corner operator
11:48:13FromDiscord<Phil> Is an easy one I could point to
11:48:17FromDiscord<odexine> In reply to @nnsee "ah yes, the Bird": LMAO
11:48:21FromDiscord<odexine> New name for it
11:48:39FromDiscord<Phil> Thank you, I now no longer can unsee what I previously saw as some kind of flag
11:49:39FromDiscord<odexine> I mean it could also be the delighted cyclops operator
11:49:55FromDiscord<odexine> If you turn it so that the point is pointing up
11:51:10FromDiscord<Phil> Ehhhh I don't see the cyclops
11:51:18FromDiscord<Phil> Meanwhile the bird beak is super obvious
11:52:29FromDiscord<odexine> I mean if you use ^_^ then you’ll see
11:53:03FromDiscord<Phil> I mean, I do but still,,, eh
11:53:07FromDiscord<Phil> (edit) "still,,," => "still..."
11:53:10FromDiscord<odexine> :ChiguPien:
12:52:08*cyraxjoe quit (Server closed connection)
12:52:24*cyraxjoe joined #nim
13:37:43FromDiscord<Chronos [She/Her]> In reply to @nnsee "ah yes, the Bird": Hey Ras, anything that you'd want in a library for handling the MC protocol?
13:39:50FromDiscord<nnsee> In reply to @chronos.vitaqua "When you *do* see": ah right, sorry, i did see this message half-asleep but forgot to respond to it
13:40:29FromDiscord<nnsee> i'm not too sure. I need to get back into writing my server to see whether I can come up with anything that might be useful 😅
13:47:11FromDiscord<Chronos [She/Her]> In reply to @nnsee "ah right, sorry, i": It's fine aha
13:47:17FromDiscord<Chronos [She/Her]> In reply to @nnsee "i'm not too sure.": Yeah fair enough aha
13:50:54*rockcavera joined #nim
13:51:08FromDiscord<Chronos [She/Her]> https://wiki.vg/Protocol#BitSet Ugh I need to figure out how to parse this...
13:51:39PMunchShould be pretty easy
13:53:30FromDiscord<Chronos [She/Her]> Probably but procrastination :P
13:54:27FromDiscord<Chronos [She/Her]> https://docs.oracle.com/javase/8/docs/api/java/util/BitSet.html#toLongArray-- reading this rn but I don't really get it? So
14:00:56*edr joined #nim
14:01:14PMunchI mean it specifies in that first link how you check the bits
14:02:36FromDiscord<Chronos [She/Her]> Seeing it different than understanding it :P
14:02:46FromDiscord<Chronos [She/Her]> But now I get it after messing with `BitSet` from java
14:06:15FromDiscord<Chronos [She/Her]> `BitsRange` from std/bitops seem to be what I need (since packedsets only support a singular ordinal type rather than multiple)
14:06:41FromDiscord<Chronos [She/Her]> (Since... Java's BitSet lets you output a long array)
14:07:21FromDiscord<Chronos [She/Her]> Actually nvm but the functionality should be similar
14:25:28*rockcavera quit (Read error: Connection reset by peer)
14:26:14*rockcavera joined #nim
14:26:14*rockcavera quit (Changing host)
14:26:14*rockcavera joined #nim
14:34:51FromDiscord<eclipse_29383> Why doesn't this work?
14:34:52FromDiscord<eclipse_29383> sent a code paste, see https://play.nim-lang.org/#ix=4LKU
14:35:03FromDiscord<eclipse_29383> (edit) "https://play.nim-lang.org/#ix=4LKU" => "https://play.nim-lang.org/#ix=4LKV"
14:35:42PMunchHmm, is there a way to create a "reset" config.nims?
14:36:20PMunchYou can't return an openArray I believe
14:36:24PMunchIt's not a concrete type
14:37:01FromDiscord<eclipse_29383> The entire point of me trying to make a function like this is because I can't declare the openArrayByte as a var
14:37:06FromDiscord<eclipse_29383> like var test = input.toOpenArrayByte(0, sizeOf(input))
14:38:13PMunchExactly
14:38:22PMunchIt's not a concrete type
14:38:25PMunchSo you can't store it
14:38:34FromDiscord<eclipse_29383> That sucks
14:38:34PMunchYou can however do something like this: https://play.nim-lang.org/#ix=4LKW
14:39:01FromDiscord<eclipse_29383> Oh, nice, let me try that rn
14:39:27PMunchNote that I also changed from sizeOf(input) to input.high
14:40:11PMunchsizeof(input) return 16 as it is the size of the string type and not the length of the string
14:41:06FromDiscord<eclipse_29383> I still can't use the output of that template inside of a variable?
14:41:12FromDiscord<eclipse_29383> (edit) "variable?" => "variable"
14:41:25PMunchNo
14:41:41PMunchAs I said openArray isn't an actual type
14:41:58PMunchWhat exactly are you trying to do?
14:42:16FromDiscord<eclipse_29383> Trying to create an array without a length that's set at compile time
14:42:22FromDiscord<eclipse_29383> And dynamically change the contents of that array
14:42:28PMunchI think you want a sequence
14:42:30FromDiscord<Chronos [She/Her]> Why not use a `seq`?
14:42:53FromDiscord<eclipse_29383> Im not familiar from seqs, I moved from py
14:42:56FromDiscord<Chronos [She/Her]> That's the exact functionality you're describing, it's similar to a `list` in Python
14:43:16FromDiscord<eclipse_29383> So just like var testSeq = @[1, 2, 3]
14:43:23FromDiscord<Chronos [She/Her]> Yep
14:43:43PMunchhttps://play.nim-lang.org/#ix=4LKX
14:43:58PMunchThat can be used in variables and passed around like normal
14:44:23FromDiscord<Chronos [She/Her]> Then you can do `testSeq.add(4)` or `testSeq.insert(0)` to add data to it
15:01:15*PMunch quit (Quit: Leaving)
15:08:15*advesperacit quit (Ping timeout: 245 seconds)
15:09:02*advesperacit joined #nim
15:18:23*jmdaemon quit (Ping timeout: 256 seconds)
15:25:12*advesperacit_ joined #nim
15:28:22*advesperacit quit (Ping timeout: 255 seconds)
15:37:59*dtomato quit (Server closed connection)
15:38:18*dtomato joined #nim
15:45:02*derpydoo joined #nim
15:50:29*gooba quit (Remote host closed the connection)
15:50:57*gooba joined #nim
15:53:56*gooba quit (Remote host closed the connection)
15:54:54*gooba joined #nim
16:01:39*gooba quit (Remote host closed the connection)
16:02:46*gooba joined #nim
16:10:41FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=4LLu
16:11:00FromDiscord<Chronos [She/Her]> Well what do you think it does?
16:11:07FromDiscord<bostonboston> I want foo to be between 0 and 100 but of type float32
16:13:05FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4LLv
16:14:28FromDiscord<bostonboston> I plan on using the range to ensure proper arguments. The alternative is to use a `clamp` in every function that accepts the argument
16:17:37FromDiscord<Chronos [She/Her]> Fair
16:20:16FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4LLw
16:22:38*krux02 joined #nim
16:29:26*gooba_ joined #nim
16:30:50*gooba quit (Ping timeout: 260 seconds)
16:37:13*gooba_ quit (Remote host closed the connection)
16:42:02FromDiscord<bostonboston> It certainly does, wonderful
16:51:20FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=4LLG
16:52:08FromDiscord<odexine> Defects are not tracked by raises
16:52:16FromDiscord<odexine> IIRC at least
17:02:06FromDiscord<bostonboston> Ah
17:06:09FromDiscord<e.e.7> Yup. See the bottom of this section: https://nim-lang.org/docs/manual.html#effect-system-exception-tracking
17:21:50FromDiscord<anuke> Why doesn't this basic anonymous procedure with `sugar` work? https://play.nim-lang.org/#ix=4LLR
17:21:58FromDiscord<anuke> https://media.discordapp.net/attachments/371759389889003532/1175123677369602108/image.png?ex=656a1635&is=6557a135&hm=c71733f2c85369756c13e82acd3af2ac090c3f7b9b11f9932937336b0e966ce7&
17:22:03FromDiscord<anuke> https://media.discordapp.net/attachments/371759389889003532/1175123699213541386/image.png?ex=656a163a&is=6557a13a&hm=e67722ebb24d90fe4fe325d827c2df9eb0d9b533ab4fcb182bcd452e4c73d284&
17:23:43FromDiscord<anuke> Does => simply not work with procs that have a void return type?
17:24:59FromDiscord<anuke> The example in the docs works until I replace the return types with void/nothing
17:26:33*gooba joined #nim
17:27:57FromDiscord<anuke> And the example with a void return types works until I add a single parameter, at which point it breaks
17:27:59FromDiscord<System64 ~ Flandre Scarlet> > Note: Channels are designed for the Thread type. They are unstable when used with spawn↵Is that still the case?
17:28:43FromDiscord<anuke> (edit) "breaks" => "breaks↵↵https://play.nim-lang.org/#ix=4LLT This also fails, why?"
17:38:45FromDiscord<griffith1deadly> In reply to @anuke "And the example with": i think it's bug and you need to create issue in nim github
17:41:48FromDiscord<anuke> This is such a basic issue that I find it hard to believe nobody has encountered it before... unless I'm basically the only person that uses anonymous procedures?
17:44:36FromDiscord<Chronos [She/Her]> Don't think most people use std/sugar
17:45:00FromDiscord<Chronos [She/Her]> In reply to @anuke "Does => simply not": Does `do (x): echo x` work instead for you?
17:45:46FromDiscord<anuke> It dos not compile
17:45:48FromDiscord<anuke> (edit) "dos" => "does"
17:46:13FromDiscord<Chronos [She/Her]> Oh wait, `do (x: int)` sorry
17:47:10FromDiscord<anuke> That woirks, but at that point I might as well write `proc (x: int) = ...`, my entire reason for using `sugar` was to omit all the types and infer them from the signature
17:47:37FromDiscord<anuke> https://github.com/nim-lang/Nim/issues/18447 Related issue, it seems this is a known problem
17:48:22FromDiscord<Chronos [She/Her]> Ah fair
17:49:47FromDiscord<anuke> I guess the takeaway here is to avoid `sugar`'s -> =>, a little sad that they're so broken
17:52:17FromDiscord<griffith1deadly> In reply to @anuke "I guess the takeaway": create issue and it should be fixed
17:54:17FromDiscord<anuke> I think a very similar issue was already filed (perhaps even multiple?) and there doesn't seem to be a fix
17:54:23*nyeaa4928423010 quit (Server closed connection)
17:54:42*nyeaa4928423010 joined #nim
18:20:53FromDiscord<apetransaction> sent a code paste, see https://play.nim-lang.org/#ix=4LMf
18:21:48FromDiscord<apetransaction> there isnt an inbuilt method of doing it
18:22:41FromDiscord<ezzypooofnazareth> Is there something wrong with nimble with nim 2.0.0? I have tried to install on windows, msys2, and wsl, also allowed nimble through my firewall but with all installations the nim compiler works, but nimble shows no output and I cannot install packages
18:22:59FromDiscord<anuke> In reply to @apetransaction "So im using illwill": `CtrlA.int`, `None.int`, etc
18:23:15FromDiscord<Phil> I can't recall who the windows peeps were in the community besides ringabout
18:23:28FromDiscord<Phil> So... @ringabout when you're online do you know anything about that one?
18:24:10FromDiscord<apetransaction> In reply to @anuke "`CtrlA.int`, `None.int`, etc": thanks, i was losing my mind
18:24:19FromDiscord<Phil> In reply to @apetransaction "So im using illwill": Keep in mind enums in truth are actually just numbers.↵So you can actually just cast ints to enums and enums to ints
18:25:55FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=4LMh
18:26:49FromDiscord<Phil> I don't think you can and if you can you shouldn't.↵Defects are equivalent to rust's panics, not like normal exception
18:27:00FromDiscord<Phil> Panic means "Program should blow up"
18:27:43*gooba quit (Remote host closed the connection)
18:28:39*gooba joined #nim
18:29:17FromDiscord<bostonboston> Then I think conversion to a range shouldn't be a defect (and you can `except` it currently). Seems extreme especially for the use case I'm in, where I want a compiler error if I attempt to give a number outside the range or an exception if it happens at run time
18:30:09FromDiscord<bostonboston> (edit) "Then I think ... conversionas" added "incorrect" | "(and" => "as long as it still fits in the base type(and"
18:31:19FromDiscord<Phil> Personally I'd make a forum post about it on the off chance you get a reply of somebody more experienced that can explain you the underlying reasons. That person is not me 😅
18:35:46FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4LMj
18:36:00FromDiscord<Chronos [She/Her]> Behold! A number!
18:36:08FromDiscord<Phil> Still just a number, you just associated it with a string
18:37:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4LMk
18:37:17FromDiscord<Chronos [She/Her]> Oh neat
18:37:26FromDiscord<Chronos [She/Her]> Welp I didn't know that
18:37:49FromDiscord<Phil> All that assignment does is it changes what `$` outputs and what you can use for parseEnum
18:38:51FromDiscord<Chronos [She/Her]> Fair enough
19:38:22FromDiscord<stoneface86> I always forget that feature exists, once did `const MyEnumNames: array[MyEnum, string] = ...` instead
19:40:50*greaser|q quit (Changing host)
19:40:50*greaser|q joined #nim
19:40:53*greaser|q is now known as GreaseMonkey
19:44:24*sagax quit (Ping timeout: 246 seconds)
19:50:32NimEventerNew thread by Boston: Should conversion outside of a range result in a Defect, see https://forum.nim-lang.org/t/10647
19:54:21FromDiscord<bostonboston> Look at this bozo
19:58:55*xet7 quit (Remote host closed the connection)
20:05:24*xet7 joined #nim
20:14:06FromDiscord<guttural666> are async iterators a thing? async iterator calling async function?
20:19:52FromDiscord<Chronos [She/Her]> In reply to @bostonboston "Look at this bozo": An int has a max value of 9223372036854775807, you're using `parseInt` which obviously expects an int
20:20:17FromDiscord<Chronos [She/Her]> The reason why it's a defect is because in Nim, you're expected to check if the user input is within the range yu want
20:21:10FromDiscord<nnsee> how do you do that without trying to parse it as an int?
20:21:38FromDiscord<nnsee> I think the question is valid
20:21:38FromDiscord<bostonboston> Yes but my point was if the user does not provide a value larger than 255 it will still be a defect, and I'm asserting that I believe it should be an exception instead
20:22:28FromDiscord<bostonboston> This also goes with my earlier question of using range with floats
20:23:06FromDiscord<Chronos [She/Her]> `parseUInt` exists
20:23:38FromDiscord<Chronos [She/Her]> In reply to @bostonboston "Yes but my point": Well... That's for you to take up with Araq, but he's had the question many times
20:45:26FromDiscord<guttural666> In reply to @guttural666 "are async iterators a": reason I'm asking this is because my web crawler could have a higher i/o latency than the allowed robot.txt delay time is, so I kinda want to have the option to fire off requests faster
20:47:34FromDiscord<nnsee> probably really easy to test, no?
20:50:56FromDiscord<guttural666> just did, it seems to be an invalid pragma for iterators
20:52:39FromDiscord<Elegantbeef> Async iterators do not make any sense
20:52:59FromDiscord<Elegantbeef> They're already practically coroutines
20:53:32FromDiscord<Elegantbeef> Maybe they do make sense and I'm daft, but it does not seem like they make much sense as async procedures are already turned into iterators
20:54:16FromDiscord<guttural666> hmmmm
20:55:58FromDiscord<guttural666> this inside the iterator does the http call, could I possibly return a future from the iterator then? something like that? https://media.discordapp.net/attachments/371759389889003532/1175177531880656916/image.png?ex=656a485d&is=6557d35d&hm=2034de7c0e19982a6c3a5e38e25325db41ab5e2a62c74ec9a20331b53efc09d1&
21:02:33FromDiscord<Elegantbeef> Cant you just yield a `Future[seq[string]]`?
21:02:59FromDiscord<Elegantbeef> The fact you have an iterator yielding a `seq[seq` is disturbing
21:03:06FromDiscord<Elegantbeef> That means you have 3 collections deep
21:03:41FromDiscord<nnsee> lasagna
21:05:01FromDiscord<guttural666> dunno, I'm just getting a batch of 200rds of one data set type per api call
21:06:08FromDiscord<Elegantbeef> `getBands` ostensibly returns a list of band names
21:06:08FromDiscord<Elegantbeef> But `result` is a `seq[seq[string]]`
21:06:18FromDiscord<guttural666> In reply to @Elegantbeef "Cant you just yield": I could, but I really want to return the batch, since that's what I'm getting
21:06:20FromDiscord<nnsee> also you probably don't have to set the result type explicitly like that
21:06:33FromDiscord<nnsee> it's in the proc signature
21:06:37FromDiscord<guttural666> get bands returns a bunch of bands with their associated data
21:06:42FromDiscord<Elegantbeef> This is an iterator there is no result variable 😄
21:06:55FromDiscord<Elegantbeef> you do realise that data types exist right?
21:06:56FromDiscord<nnsee> ah right
21:07:05FromDiscord<Elegantbeef> `getBands` should return `seq[Band]`
21:07:42FromDiscord<guttural666> In reply to @Elegantbeef "you do realise that": don't really need them (yet) since I'm dumping everything in an sql data base straight away, so I thought why bother
21:08:49FromDiscord<guttural666> ugly for now, but this won't really change in the future https://media.discordapp.net/attachments/371759389889003532/1175180764195848222/image.png?ex=656a4b5f&is=6557d65f&hm=2a500495c20ce94e0e6e6c08014d4aef37ce79f50061631f96956961ee51f4e2&
21:09:20FromDiscord<nnsee> parameterized queries, love to see that
21:10:00FromDiscord<guttural666> if that was irony, I don't know enough to get it 😄
21:10:15FromDiscord<nnsee> the amount of SQL injection vulns I've identified in the current year has astonished me for like 5 years straight
21:10:21FromDiscord<nnsee> In reply to @guttural666 "if that was irony,": not ironic at all
21:10:32FromDiscord<nnsee> genuinely glad
21:10:37FromDiscord<Elegantbeef> Cmon guttural it's simple and makes your life much better
21:10:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LMT
21:10:55FromDiscord<guttural666> oh okay, can you elaborate on why you think that's good?
21:11:13FromDiscord<nnsee> who, me or beef?
21:11:35FromDiscord<guttural666> In reply to @nnsee "who, me or beef?": you, why did you say that was good compared to what?
21:12:03FromDiscord<guttural666> In reply to @Elegantbeef "Cmon guttural it's simple": I'm building rn! 😄 I will improve everything as I go and see a need, I just want to build a working skeleton rn
21:13:55FromDiscord<nnsee> In reply to @guttural666 "you, why did you": well the (grossly incorrect) alternative is to construct the SQL sentence by either concatenating it or using format strings, which instantly leads to SQL injection vulnerabilities since an attacker could insert quotes etc to restructure the SQL query. Best case, they can read arbitrary data from the database. Worst case, execute code. Inserting and deleting data is somewhere in-between
21:14:32FromDiscord<nnsee> and it has been such a prevalent vulnerability for so, so many years now
21:14:41FromDiscord<nnsee> you would think developers learn
21:15:02FromDiscord<guttural666> In reply to @nnsee "well the (grossly incorrect)": gotcha
21:15:28FromDiscord<guttural666> sanitizers should be able to see this I reckon
21:15:33FromDiscord<nnsee> anyways parameterized queries, like the one you're using, prevent SQL injection (if it's done correctly by the lib/framework... there's also been issues with that)
21:15:53FromDiscord<Phil> In reply to @nnsee "you would think developers": Nobody ever accused me of doing that and I won't force you to be the first!
21:17:58FromDiscord<Elegantbeef> The only think I can say phil has learned is to piss me off
21:18:29FromDiscord<guttural666> 🤣
21:21:36FromDiscord<guttural666> btw. I am pretty sure Nim should be able to generate those sql statements automatically based on the Band type, correct? could that be done with templates or macros? https://media.discordapp.net/attachments/371759389889003532/1175183986637680731/image.png?ex=656a4e60&is=6557d960&hm=a79c0fbfbb5c1ba74850a664ef04af9c7ad3b946e9787003db595b1a63ed859f&
21:22:38FromDiscord<nnsee> `Band.id` instead of `Band[0]`
21:22:58FromDiscord<guttural666> yes
21:23:05FromDiscord<guttural666> c+p example
21:23:24FromDiscord<nnsee> oh, that was a general question?
21:23:38FromDiscord<nnsee> what you're describing is an ORM and there are a few Nim implementations for that
21:23:55FromDiscord<guttural666> just wonder what the probable level of abstraction would be to implement something that generates those sql statements based on types
21:24:54FromDiscord<guttural666> rn I don't really care, I'm hard coding everything, but if my application becomes more complex, I might not want to write all this boiler plate for all the types
21:25:06FromDiscord<nnsee> check out https://github.com/moigagoo/norm
21:25:29FromDiscord<Chronos [She/Her]> Also https://github.com/treeform/debby :P
21:25:35FromDiscord<guttural666> ah, there's a thing for everything in Nim 😄
21:26:08FromDiscord<nnsee> In reply to @guttural666 "ah, there's a thing": weeelllll
21:26:38FromDiscord<nnsee> i feel like "everything" could be a lot larger than what Nim libs provide, but it's getting there lol
21:28:05FromDiscord<guttural666> I just think the capabilities meta programming provide is off the charts, it's just crazy powerful
21:28:23FromDiscord<nnsee> that much is very true
21:28:28FromDiscord<guttural666> just fantastic
21:29:46FromDiscord<Chronos [She/Her]> The lang I'm trying to work on will hopefully take a lot of inspiration from Nim's macro system :)
21:29:58FromDiscord<Chronos [She/Her]> I really like a lot about Nim
21:30:20FromDiscord<guttural666> coming from C++ it's just stupid how much power you can wield without much effort
21:35:19FromDiscord<saint.___.> In reply to @chronos.vitaqua "The lang I'm trying": Why are you writing another lang?
21:35:29FromDiscord<Chronos [She/Her]> In reply to @saint.___. "Why are you writing": JVM :P
21:37:26FromDiscord<saint.___.> In reply to @chronos.vitaqua "JVM :P": Ahh
21:37:34FromDiscord<saint.___.> Why not make nim work with the jvm
21:37:48FromDiscord<saint.___.> Partially or something
21:39:50FromDiscord<bostonboston> Best idea
21:39:54FromDiscord<Chronos [She/Her]> In reply to @saint.___. "Why not make nim": I did try, but Nim's AST is just too much for me to wrap my head around especially if I want to maintain a lot of the Nim semantics, if I only cared about syntax then it'd be easier
21:40:26FromDiscord<bostonboston> Someone smarter than me should implement nim in clr too
21:41:52FromDiscord<nnsee> In reply to @saint.___. "Why not make nim": it technically does
21:42:26FromDiscord<nnsee> using graal's polyglot functionality, you can run nim's js output on the jvm
21:42:37FromDiscord<saint.___.> In reply to @nnsee "using graal's polyglot functionality,": Interesting
21:42:43FromDiscord<nnsee> it's not very useful, though
21:43:43FromDiscord<nnsee> the nim js backend is meant for the browser so there isn't an easy way to interact with the system from nim land
21:44:04FromDiscord<nnsee> it's probably not too hard to write a shim that lets you call java stuff from Nim, though
21:44:17FromDiscord<Chronos [She/Her]> In reply to @nnsee "it's probably not too": Probably not
21:44:31FromDiscord<Chronos [She/Her]> In reply to @nnsee "using graal's polyglot functionality,": This also means you can only use one thread though
21:44:34FromDiscord<Chronos [She/Her]> Which is less great
21:55:06FromDiscord<nnsee> true, but would probably be alleviated with being able to call into native java land
21:55:18FromDiscord<nnsee> with what all the new fancy lightweight java threads and whatnot
22:01:20FromDiscord<Elegantbeef> Who needs more than a single thread
22:01:56FromDiscord<michaelb.eth> spiders
22:02:30FromDiscord<guttural666> In reply to @Elegantbeef "Who needs more than": such heresy
22:03:07FromDiscord<guttural666> thread all the things, gotta go fast
22:04:58FromDiscord<Chronos [She/Her]> In reply to @nnsee "true, but would probably": Graal can't access things being accessed on different threads which sucks, for example, GraalJS has to use synchronized blocks on everything when hooking into chunk generation, which slows it down a lot
22:05:10FromDiscord<Chronos [She/Her]> In reply to @nnsee "with what all the": Aren't those more closer to async or something?
22:09:24FromDiscord<Chronos [She/Her]> When should I use `val in {}` instead of `val in []`?
22:17:07FromDiscord<Elegantbeef> When you have an ordinal type that as a bitset does not use a lot of bits
22:17:54FromDiscord<Chronos [She/Her]> Does an `enum` work then for this usecase?
22:18:09FromDiscord<Elegantbeef> `a in {}` is `O(1)` but takes sizeof(a) bits `a in []` is `O(N)` but takes `len([...]) sizeof(a)` bytes
22:20:47FromDiscord<Chronos [She/Her]> Hm... I think a set would be fine here then
22:22:22FromDiscord<guttural666> In reply to @chronos.vitaqua "Hm... I think a": building a tokenizer are you?
22:22:26FromDiscord<Elegantbeef> You have not elaborated this case... 😄
22:24:52FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4LN6
22:25:04FromDiscord<Elegantbeef> In that case a bitset is fine
22:25:30FromDiscord<Elegantbeef> Probably up to any ordinal with 256 values you're likely fine to use a bitset
22:25:41FromDiscord<Elegantbeef> I havent benchmarked it but the larger you go the slower it is to allocate
22:25:46FromDiscord<Chronos [She/Her]> Rad
22:25:48FromDiscord<Elegantbeef> `set[uint16]` uses 65k bits afterall
22:26:17FromDiscord<Elegantbeef> initialising 65k bits is quite a large operation
22:26:43FromDiscord<Chronos [She/Her]> Yeah I understand that-
22:28:00FromDiscord<Chronos [She/Her]> Hm... Do I want to make my literal type distinguish between an `int` and `uint`.... Hm
22:28:17FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4LN7
22:29:37FromDiscord<Chronos [She/Her]> I'm gonna do that so it's easier to do
22:32:41FromDiscord<nnsee> In reply to @chronos.vitaqua "Aren't those more closer": from a quick glance they seemed to be more akin to goroutines
22:32:46FromDiscord<nnsee> might be misremembering though
22:33:45FromDiscord<Chronos [She/Her]> Ah fair, idk how Goroutines work tbh
22:40:54*gooba quit (Remote host closed the connection)
22:41:15*gooba joined #nim
22:52:09*attah quit (Server closed connection)
22:52:29*attah joined #nim
22:53:26FromDiscord<guttural666> is there a good way to delete entries from a seq while looping over them?
22:53:48FromDiscord<Elegantbeef> Iterate backwards using the index
22:54:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4LN9
22:54:41FromDiscord<guttural666> and if I want to preserve first in first out, I could insert at 0
22:56:34FromDiscord<guttural666> is there and add front?
22:58:34FromDiscord<Elegantbeef> No cause that's an `O(N)` operation
22:58:35FromDiscord<Elegantbeef> use `std/deques`
23:05:39FromDiscord<guttural666> thanks!
23:13:03*krux02 quit (Remote host closed the connection)
23:21:36*lumidify quit (Server closed connection)
23:21:50*lumidify joined #nim
23:33:50*FromDiscord quit (Server closed connection)
23:34:22*FromDiscord joined #nim
23:36:10FromDiscord<System64 ~ Flandre Scarlet> Does someone know if channels support spawn() please?
23:45:56FromDiscord<Elegantbeef> Why do channels have to support anything?
23:47:36FromDiscord<Phil> Because somebody's ought to support this roof we're all staying under!
23:53:28*advesperacit_ quit ()
23:54:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Why do channels have": > Note: Channels are designed for the Thread type. They are unstable when used with spawn