<< 27-11-2021 >>

00:00:39FromDiscord<evoalg> I was reading that macro link above ... it seems to me that if Nim supported the syntax and functionality of what a particular macro was trying to do, then there would be no need for that particular macro, and so I'm thinking that writing macro's is like extending the Nim language itself ... is that right or am I bonkers?
00:03:25FromDiscord<Elegantbeef> Hmm a particular macro
00:03:49FromDiscord<Elegantbeef> It is indeed a method of extending the Nim language
00:04:01FromDiscord<Yardanico> In reply to @evoalg "I was reading that": yes, you're right in that
00:04:11FromDiscord<Yardanico> you can implement what macros do in the compiler and then it'll become a language feature
00:04:28FromDiscord<evoalg> nice!
00:04:37FromDiscord<Elegantbeef> Macros are realistically defined as "User defined compilation passes"
00:05:28FromDiscord<Elegantbeef> I do have an idea how to support unpacking in proc calls and var assignment, but no clue if Nim would accept it
00:07:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gdu
00:09:51FromDiscord<Elegantbeef> When doing tuple assignment it calls those procs and when doing a proc call you'd do something like `doThing(...(10, 20))`
00:25:18FromDiscord<evoalg> Cheers! It's like creating a super-set language of Nim that supports extra syntax to do cool stuff I want. I can see how it's very powerful (but advanced stuff for me).
00:31:11*ormiret quit (Ping timeout: 245 seconds)
00:31:45*ormiret joined #nim
00:32:11*pch quit (Remote host closed the connection)
00:33:13FromDiscord<Elegantbeef> Yep in other languages it requires compiler support, like async
00:33:16*notchris quit (Ping timeout: 245 seconds)
00:33:31FromDiscord<Elegantbeef> Thanks to macros we can do it all in "userspace" instead of relying on the compiler devs to add it
00:35:22*notchris joined #nim
00:41:01FromDiscord<evoalg> yay! ... do away with those dirty devs ... but seriously, I can see that if I was super duper brainy and creative then I could do a loads with all that freedom
00:41:22FromDiscord<Elegantbeef> Indeed, you can do quite wonderful things
00:41:56FromDiscord<Elegantbeef> They can remove a lot of boiler plate or similar
00:44:21FromDiscord<Elegantbeef> Oh and evoalg i did make that repl and it's pretty much 100% useless and a toy
00:45:14FromDiscord<evoalg> oh nice! ... the macro one right? ... will it help you to debug macro's while you're building them?
00:45:39FromDiscord<Elegantbeef> drop-2021-11-24\_15.34.24.mp4 https://media.discordapp.net/attachments/371759389889003532/913953681198678026/drop-2021-11-24_15.34.24.mp4
00:45:41FromDiscord<Elegantbeef> It's supposed to but it's less than useful i wager
00:45:57FromDiscord<Elegantbeef> There is a video of it in use
00:47:32FromDiscord<evoalg> So, you used macro's to help you use macro's?
00:47:46FromDiscord<Elegantbeef> Well i used the NimVM and macros to help macro 😛
00:47:59FromDiscord<evoalg> that's very cool
00:49:58FromDiscord<evoalg> When I get into macro's I'll ask you able it further ... for now I'm waiting to be stronger in the basics. I do feel that I understand what macro's are used for now (from a 50 thousand foot level)
00:50:37FromDiscord<Elegantbeef> Cmon you can be atleast on everest looking down at the trench!
00:51:16FromDiscord<evoalg> I guess my eyes aren't as good as they were when I was your age
00:52:06FromDiscord<Elegantbeef> Fairly certain there is a logistical issue that even elven eyes dont solve
00:56:15FromDiscord<Elegantbeef> Talking to you today reminded me about the dumb resetable closure restraint, so now we can reassign to the same closures!
00:57:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GdC
01:00:22FromDiscord<Elegantbeef> But that `true` in the items iterator makes me angry so... distinct it is!
01:03:17FromDiscord<evoalg> let me try and digest that!
01:06:37FromDiscord<Elegantbeef> It's not that complicated, `a` is a resetable closure which in this case means you can either do `.reset` or `items(true)`(though it's now `items(Reset)`) to set values to their default
01:07:15*krux02 joined #nim
01:07:18FromDiscord<Elegantbeef> So in the case of `asResetableClosure("hello"[1..2])` it stores `"hello"` and `1..2` in `a` and when you call `reset` reinitializes the iterator
01:08:14FromDiscord<evoalg> easy!
01:08:41FromDiscord<Elegantbeef> The confusing stuff is the macro in the background that converts the iterator to a closure and generates it
01:11:01*krux02 quit (Remote host closed the connection)
01:14:19FromDiscord<codic> finally released the rewrite of my nim wm, yay https://media.discordapp.net/attachments/371759389889003532/913960896714375168/unknown.png
01:14:35FromDiscord<codic> (edit) "nim wm," => "wm in nim,"
01:23:21FromDiscord<evoalg> In reply to @Elegantbeef "The confusing stuff is": I'm such a noob I had to do this to understand it: https://play.nim-lang.org/#ix=3GdG
01:25:15FromDiscord<evoalg> (I forgot a `print x` in line 27 too)
01:33:03FromDiscord<Elegantbeef> But hey you understand the silly thing 😛
01:34:57FromDiscord<evoalg> remind me ... a normal slice in Nim is not an iterator, but the slicerator module makes it into an iterator (which means for large slices it's memory efficient and possibly speed effecient), and furthermore, slicerator also has the option of making closure iterators out of normal iterators, and even has a resetable closure iterator ... is that right?
01:35:12FromDiscord<Elegantbeef> Yep
01:35:37FromDiscord<superfunc> In reply to @Elegantbeef "Thanks to macros we": big agree, metaprogramming is how clojure got async, pattern matching and a bunch of other neat stuff
01:36:03FromDiscord<Elegantbeef> You can do `for x in @[10, 20, 30, 40][0..2]` and it will do a non allocating immutable slice with slicerator
01:36:27FromDiscord<Elegantbeef> Or if you want a mutable slice you can do `for x in @[10, 20, 30, 40]{0..2}`
01:39:24FromDiscord<Elegantbeef> And you seem to grasp what a resetable closure does
01:40:27FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3GdJ
01:40:44FromDiscord<Elegantbeef> Well that was a dumb example since `@[10, 20, 30, 40]` isnt mutable
01:41:05FromDiscord<Elegantbeef> it should be `var a = @[10, 20, 30, 40]` and `for x in a{0..2}: x = 300`
01:41:06FromDiscord<evoalg> ahhh true it's a literal
01:41:15FromDiscord<evoalg> nice
01:44:06FromDiscord<Elegantbeef> There is also some dumber stuff in that package i question removing
01:44:19FromDiscord<Elegantbeef> But yea slices + iterators as closure is mostly all the magic
01:45:31*pch joined #nim
01:45:38FromDiscord<evoalg> "dumber" implies the above is dumb, but it seems to me it's not dumb at all, as it's not satisfying (at least to me) that some of the core Nim things aren't iterators when they should be
01:46:05FromDiscord<Elegantbeef> Nah there is more in that package which is dumb
01:46:41FromDiscord<Elegantbeef> Like i said though this stuff couldnt be done pre 1.6
01:46:52FromDiscord<Elegantbeef> `[]` was not allowed for iterators
01:47:23FromDiscord<evoalg> remove the other parts and get this into Nim 2.0 as default? Am I being naive again?
01:47:58FromDiscord<Elegantbeef> Well 1.6.2 maybe idk
01:48:24FromDiscord<evoalg> that would be awesome
01:55:29FromDiscord<evoalg> resetable or resettable?
02:02:39FromDiscord<Elegantbeef> I'll tell you when i learn to write remedial english 😛
02:03:43FromDiscord<Elegantbeef> It's now spelled properly, well not properly but with two Ts 😛
02:04:26FromDiscord<evoalg> I'm a shocking speller ... my spell check was complaining that's all 😉
02:04:51FromDiscord<Elegantbeef> Cheers, i cannot spell and let rika bitch and moan about it
02:06:35FromDiscord<evoalg> I like findAll and rFindAll ... I hope they won't be taken out?
02:06:45FromDiscord<Elegantbeef> Probably not
02:06:52FromDiscord<Elegantbeef> `collectit` probably will be
02:08:27FromDiscord<evoalg> unless it's argued that some should be moved to a different module?
02:09:36FromDiscord<evoalg> (I don't know and I'm not good with such things)
02:13:13FromDiscord<evoalg> oh you changed it to "Resttable"
02:13:32FromDiscord<evoalg> you did it on purpose to wind Rika up
02:16:07FromDiscord<Elegantbeef> Hey apparently that's how it's spelled
02:16:55FromDiscord<evoalg> it does have two t's in it, I'll give you half a mark
02:17:16FromDiscord<Elegantbeef> Lol i cannot fucking spell
02:22:17FromDiscord<Mocha> is there a naming convention for types/variables that have to contain version numbers/decimals? e.g. "Version 1.3" -> Version13
02:23:05FromDiscord<Elegantbeef> I think `TypevNumber` is the idiomatic way
02:23:39FromDiscord<Elegantbeef> Personally i'd prefer using a pragma and a string or tuple to get the type, but that's probably needlessly complex
02:28:08FromDiscord<Mocha> Oh thanks, I didn't know `TypevNumber` was idiomatic! Planning on just using a pure enum; just to confirm, if the version number has decimals (e.g. 1.2, 1.3, 1.4...), convention is just to omit them in the name?
02:29:11FromDiscord<Elegantbeef> Yep
02:29:19FromDiscord<Elegantbeef> Atleast i think so, it's very much up to you
02:31:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GdR
02:31:42FromDiscord<Elegantbeef> But likei said probably needlessly complex
02:32:12FromDiscord<Mocha> oh the type itself doesn't need to be versioned, I'm just building a library that has to be aware of multiple protocol versions
02:32:21FromDiscord<Elegantbeef> Ah
02:32:41FromDiscord<Elegantbeef> Could be done with a static enum then
02:34:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GdS
02:34:23FromDiscord<Elegantbeef> `[T: static ProtocolVersion]`\
02:34:32FromDiscord<Elegantbeef> But that very much depends
02:34:33FromDiscord<Mocha> interesting
02:34:39FromDiscord<Mocha> i'll look into it for sure
02:34:46*src quit (Quit: Leaving)
02:34:47FromDiscord<Elegantbeef> What's the protocol?
02:34:52FromDiscord<Mocha> TLS :)
02:35:15FromDiscord<Elegantbeef> Ah so something that probably certainly only adds?
02:35:24FromDiscord<Mocha> yep
02:36:14FromDiscord<Elegantbeef> So then yea might be able to use that method and then you just have `proc doThing(myType: MyType)`
02:36:27FromDiscord<Elegantbeef> Unless you need to dispatch off that enum
02:38:15*neurocyte0132889 quit (Ping timeout: 268 seconds)
02:52:04*rockcavera quit (Remote host closed the connection)
03:04:49FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3GdY
03:05:02FromDiscord<Elegantbeef> `elif` is the `elif` version of `when`
03:05:26FromDiscord<Anonymous Poet> 😮
03:05:50FromDiscord<Elegantbeef> Do wish there was a built in case statement version of `when` would make life nicer 😀
03:05:52FromDiscord<Anonymous Poet> thanks! thats awesome
03:06:17FromDiscord<Anonymous Poet> this is good enough for my case now, not that many cases to enumerate ... would be kinda nice though
03:06:41FromDiscord<Elegantbeef> I mean it's technically possible with case statement macros but yea not great
03:07:29FromDiscord<Anonymous Poet> nim to the resuce yet again haa
03:07:30FromDiscord<Anonymous Poet> haha
03:36:50FromDiscord<impbox [ftsf]> trying to use redis to do `zrangebyscore` but I get ` Exception message: Expected '' at the beginning of a status reply got '-'`, is there a way to get the error?
03:37:22FromDiscord<Elegantbeef> What do you mean?
03:37:45FromDiscord<impbox [ftsf]> well the `-` in redis signifies an error, and it's usually followed by an error message from the server
03:38:05FromDiscord<Elegantbeef> Ah then not a clue
03:39:04FromDiscord<impbox [ftsf]> seems like a nim redis bug since the same command works via cli, but not sure
03:42:46FromDiscord<impbox [ftsf]> aha `-ERR syntax error`
03:50:40FromDiscord<impbox [ftsf]> yep, bug in nim redis
03:51:19FromDiscord<impbox [ftsf]> well.. it was, but already fixed
03:52:09FromDiscord<impbox [ftsf]> looks like it needs a version bump
03:53:31FromDiscord<gogolxdong (liuxiaodong)> sent a code paste, see https://paste.rs/JLP
03:55:46*arkurious quit (Quit: Leaving)
03:56:08FromDiscord<gogolxdong (liuxiaodong)> Test fails with unknown Bool type in nim-web3 recently.
03:57:05FromDiscord<gogolxdong (liuxiaodong)> Is Bool type still usable or what's the alternative type?
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:30:59FromDiscord<Yardanico> `Bool` doesn't exist in Nim by default or in stdlib, it must be something specific to nim-web3 or some of the libraries it uses
04:37:04FromDiscord<Rika> Also bad naming because it’s too similar to regular bool
04:47:12FromDiscord<Yardanico> looks like it's generated in a macro https://media.discordapp.net/attachments/371759389889003532/914014468575465492/unknown.png
04:47:20FromDiscord<Yardanico> solidity contracts, web3 crypto stuff
04:47:23FromDiscord<Yardanico> https://github.com/status-im/nim-web3/blob/master/web3/encoding.nim#L83
04:55:13*cheer[m] joined #nim
05:38:40FromDiscord<jfmonty2> Using Zippy (https://github.com/guzba/zippy) to compress a big string at compile-time, and I'm finding that it's really slow. Like, takes 5 minutes to compress 500KB slow. Am I doing something wrong or is it just "tough luck, compile-time execution is slow" ?
05:39:30FromDiscord<impbox [ftsf]> hmm compile time is probably slow
05:39:37FromDiscord<Elegantbeef> Consider using supersnappy instead
05:39:57FromDiscord<Elegantbeef> It's a less efficient for size compression algorithim but also cheaper for performance
05:41:13FromDiscord<jfmonty2> interesting, I'll have to take a look.
05:41:51FromDiscord<demotomohiro> You would better to run a external command to compress large string and staticRead the output at compile time.
05:42:11FromDiscord<impbox [ftsf]> aye
05:42:11FromDiscord<Elegantbeef> Probably, though this does give me a good idea to benchmark the VM
05:42:35FromDiscord<jfmonty2> yeah, that was the other thing that occurred to me. It's just a bit of a pain because I'll have to read the original string anyway so I can count the newlines. Not a huge deal though.
06:08:26FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3Get
06:11:25FromDiscord<Elegantbeef> Hmm yea that's not calling the iterator anymore, which is an other allocation, so unacceptable!
06:13:29FromDiscord<Yardanico> In reply to @jfmonty2 "Using Zippy (https://github.com/guzba/zippy) to": If compile time compression is slow you can always call some external binary and save its output in a const :)
06:13:42FromDiscord<Yardanico> Perhaps even the binary made by yourself for that specific purpose
06:13:48FromDiscord<Yardanico> A little hack
06:15:20FromDiscord<Elegantbeef> Already mentioned yard, how dare you repeat help!
06:15:38FromDiscord<Yardanico> Where did you mention that? I honestly didn't see
06:15:48FromDiscord<Elegantbeef> I didnt
06:16:14FromDiscord<impbox [ftsf]> yard has blocked everyone except beef
06:16:25FromDiscord<Yardanico> Look
06:16:26FromDiscord<Elegantbeef> I am just kidding of course but it was mentioned to use an external program
06:16:30FromDiscord<Yardanico> (edit) "Look" => "Lol"
06:16:34FromDiscord<Yardanico> yeah I see it now
06:16:39FromDiscord<Yardanico> I was focused on your messages
06:16:44FromDiscord<impbox [ftsf]> fair
06:16:59FromDiscord<Elegantbeef> Ah yea they're like a car crash
06:17:06FromDiscord<Elegantbeef> Dont want to look but cant look away
06:21:24FromDiscord<Elegantbeef> @evoalg\: there we go now you can do `"Hello".pairs(0..^2)`
06:21:39FromDiscord<Elegantbeef> Do like that you're using slicerator, making it better one subtly at a time
06:22:18FromDiscord<evoalg> nice ... it'll potentially break existing code by importing it though right?
06:22:25FromDiscord<Elegantbeef> The index is the index in the array and not since the start of the slice, which might be backwards
06:22:34FromDiscord<Elegantbeef> Nope
06:22:45FromDiscord<Elegantbeef> It the normal overload will take priority
06:22:50FromDiscord<evoalg> nice!
06:23:17FromDiscord<Elegantbeef> `for i, x in someIter` will call `pairs()` the fact you need to do `(0..1)` or `(0..^1)` means it'll never call it
06:28:18FromDiscord<evoalg> I'm not sure i understand. It looks like slicerator still breaks existing code that's like `for i, x in "Hello"[0..^2]:`
06:28:32FromDiscord<Elegantbeef> You mean it'll fix it
06:29:13FromDiscord<Elegantbeef> Well there is some ambiguity for that now with the iterator`[]` so you need to call pairs
06:29:29FromDiscord<Elegantbeef> And some argue you should call the iterator anyway 😀
06:30:05FromDiscord<Elegantbeef> `for` is looking for an iterator you're doing `i, x` so it's expecting `[]` to return a tuple, but it doesnt
06:30:36FromDiscord<Elegantbeef> The solution is to call `.pairs` be it the builtin or iterator version of `"Hello".pairs(0..^2)`
06:31:23FromDiscord<Elegantbeef> So i guess it does break code in this one instance, but the break would get you more performant code so i think it's kinda the point of importing slicerator
06:31:51FromDiscord<Elegantbeef> The entire point of slicerator is to encourage 0 allocating slices and using iterators more
06:32:40FromDiscord<Elegantbeef> `for i, x in "Hello"[0..^2]` without it is just a hack that is abused for "proper" behaviour imo
06:33:25FromDiscord<Elegantbeef> We're abusing the fact `"Hello[0..^2]` returns a sequence then iterating over that sequence with `pairs` since we want `i, x`
06:34:33FromDiscord<Elegantbeef> I suppose I could use an operator for creating the slice so it doesnt interfere like `"hello"[&0..^2]`
06:34:36FromDiscord<evoalg> Yea I think it's a great idea.
06:35:03FromDiscord<evoalg> I mean using an iterator is a great idea
06:35:40FromDiscord<Elegantbeef> Yea i dont like using a unary operator for removing the ambiguity since sliceing a sequence is "wrong" in this case
06:36:05FromDiscord<evoalg> I just don't know enough about Nim or the community
06:36:45FromDiscord<evoalg> So for a normal `for x in myseq:` with no slice, another copy isn't done right?
06:36:59FromDiscord<Elegantbeef> Yea i dont really care about getting slicerator added to the stdlib, it's opinionated and forces better iterations
06:37:12FromDiscord<evoalg> true
06:37:13FromDiscord<Elegantbeef> You're correct that iterates it as is
06:37:39FromDiscord<evoalg> might it break imported code that I didn't write?
06:37:47FromDiscord<evoalg> or doesn't import work like that?
06:37:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GeM
06:37:55FromDiscord<Elegantbeef> Import doesnt work that way
06:38:14FromDiscord<evoalg> ahh ok ... and also ahh ok 🙂
06:38:14FromDiscord<Elegantbeef> Imported symbols can only go up in normal nim
06:38:33FromDiscord<Elegantbeef> To get them to go down you need to abuse features of the compiler
06:38:43FromDiscord<Elegantbeef> So you'd know that what you're doing is going to fuck it up
06:41:20FromDiscord<evoalg> Why does "enumerate" still support `for i, x in ` when it's still an iterator?
06:41:42FromDiscord<Elegantbeef> Enumerate yields a tuple
06:42:01FromDiscord<Elegantbeef> Actually sorry enumerate is a macro
06:42:11FromDiscord<Elegantbeef> So it rewrites the entire for loop
06:45:14FromDiscord<Elegantbeef> I guess i didnt explain
06:45:31FromDiscord<Elegantbeef> But if you do `for i, x in enumerate(mySeq.items)` it'll yield `index, value`
06:45:47*neocron joined #nim
06:45:57FromDiscord<Elegantbeef> Doesnt make much sense in this case since `pairs` exists, but in cases that you dont have pairs it does
06:46:41FromDiscord<evoalg> it mostly makes sense
06:47:45FromDiscord<evoalg> ... but where pairs would do another copy of a slice, enumerate wouldn't? (just like slicerator?)
06:47:54FromDiscord<evoalg> (I'm just trying to get my head around it)
06:48:16FromDiscord<Elegantbeef> pairs doesnt do the copy
06:48:31FromDiscord<Elegantbeef> `"hello"[0..^2]` creates a new string "hell" which then we call pairs on
06:48:37*Doraemon quit (Ping timeout: 268 seconds)
06:48:45FromDiscord<evoalg> ahhh ok
06:49:16FromDiscord<Elegantbeef> without slicerator you're always calling the slice proc so it's always reallocating whenever you slice
06:49:32FromDiscord<Elegantbeef> And of course it's pointless when you're iterating
06:49:35FromDiscord<evoalg> oh!
06:49:46FromDiscord<evoalg> that makes sense
06:50:19FromDiscord<Elegantbeef> Good!
06:51:26FromDiscord<evoalg> (and hence the need for slicerator) ... hehe thank you for today's lesson ... my head is about to explode with info again 😄
06:52:14FromDiscord<Elegantbeef> Yep, with slicerator(assuming you dont use pairs) you get a dropin replacement that gives you a smaller memory footprint and slightly faster operation
06:52:35FromDiscord<Rika> i saw something about a unary
06:52:50FromDiscord<Rika> oh it was something else
06:53:16FromDiscord<Elegantbeef> Well it was a possibility to stop the slice iterator being confused for a slice
06:53:21FromDiscord<Rika> i was thinking of why not make a unary or a function that makes any iterable into an "intermediate" where [..] does proper iterator slicing
06:53:38FromDiscord<Elegantbeef> It's not needed
06:53:48FromDiscord<Rika> im not a fan of pairs(..)
06:53:50FromDiscord<Rika> i
06:53:53FromDiscord<Rika> whoops
06:54:04FromDiscord<impbox [ftsf]> i,m .. pairs()
06:54:33FromDiscord<Elegantbeef> Well `enumerate("hello"[0..^2])` works so alias `enumerate`?
06:55:34FromDiscord<Elegantbeef> I dont know `.pair(a..b)` kinda sucks, but short of doing `[&a..&b]` or similar i dont think it can be done nicely
06:56:10FromDiscord<Elegantbeef> Already using `{}` for mutable slices
06:56:25FromDiscord<Rika> <some name here>(x)[a..b] idk
06:57:08FromDiscord<Elegantbeef> PRs welcomed is all i can say cause yea i dont like it but i cant think of something reasonable
06:58:41FromDiscord<Elegantbeef> Ooh might be able to use a distinct open array
06:58:52NimEventerNew thread by GalaxyDragon: Nim On AVR, see https://forum.nim-lang.org/t/8659
07:00:29NimEventerNew Nimble package! jester2swagger - Converts a file with Jester routes to Swagger JSON which can be imported in Postman., see https://github.com/ThomasTJdev/jester2swagger
07:02:14FromDiscord<Elegantbeef> Seems that's a no
08:17:05*n59 joined #nim
08:18:01*n59 quit (Client Quit)
09:00:37NimEventerNew Nimble package! riimut - Transform latin letters to runes & vice versa. Four runic dialects available., see https://github.com/stscoundrel/riimut-nim
09:48:48*lumo_e joined #nim
09:57:51FromDiscord<Hex08> sent a code paste, see https://play.nim-lang.org/#ix=3Gfj
09:58:22FromDiscord<Rika> You only need to assign it to the first entry
09:58:25FromDiscord<Rika> Otherwise no
09:59:06FromDiscord<Hex08> In reply to @Rika "You only need to": Sorry I don't understand what you mean
09:59:15FromDiscord<Hex08> Adding a `.Natural` only to the `1` doesn't seem to work
09:59:17FromDiscord<Rika> Only 1 needs to have suffix
09:59:20FromDiscord<Rika> Really now
09:59:35FromDiscord<Hex08> Oh no!
09:59:39FromDiscord<Hex08> Sorry you're right
09:59:46FromDiscord<Rika> !eval var arr: array[4, Natural] = [1.Natural, 2, 3, 4]
09:59:49NimBot<no output>
09:59:52FromDiscord<Hex08> I had some leftover code, your suggestion works
09:59:55FromDiscord<Rika> Yeah
10:00:03FromDiscord<Rika> It’s at least somewhat better than all entries
10:00:09FromDiscord<Rika> Of course it’s still not the best
10:01:04FromDiscord<Hex08> Yeah it's alright, I think in Rust you would need a suffix for each but I'm not 100% sure
10:02:14FromDiscord<Elegantbeef> It might resolve it from it's type inference
10:02:50FromDiscord<Rika> Yeah reverse inference would be nice
10:03:56FromDiscord<Hex08> In reply to @Elegantbeef "It might resolve it": Yeah but it will still complain that the literals don't match
10:04:07FromDiscord<Hex08> You need a suffix for each 😦 https://media.discordapp.net/attachments/371759389889003532/914094224843100170/unknown.png
10:04:26FromDiscord<Elegantbeef> Oh interesting
10:05:04FromDiscord<Elegantbeef> I guess it's ambiguous if it should be a int or float and they're sticklers for "correct"?
10:06:28FromDiscord<Hex08> Yes, I might be wrong but I think Rust doesn't ever implicitly cast primitive types
10:06:47FromDiscord<Hex08> `int / float` is an error and you have to do `int as f64 / float`
10:08:42FromDiscord<Elegantbeef> Yea seems they'll infer the size of an integer but never make it a float
10:08:45FromDiscord<Elegantbeef> Which is an odd behaviour
10:09:10FromDiscord<Rika> That’s just annoying
10:10:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gfm
10:10:31FromDiscord<Rika> That’s normal at least
10:10:37FromDiscord<Rika> Same issue with Nim
10:10:51FromDiscord<Rika> Ah save for the integer part
10:11:07FromDiscord<Elegantbeef> Guess they view that int -\> sized int is okay to do implicitly but int -\> float is a no no
10:11:14FromDiscord<Rika> Wait no the whole thing is still like Nim yeah
10:11:29FromDiscord<Rika> I mean of course
10:11:47FromDiscord<Elegantbeef> It's not like Nim really
10:11:52FromDiscord<Rika> Integers can’t be fully represented by their same sized float counterparts
10:11:55FromDiscord<Elegantbeef> you can pass a numeric literal to any type
10:12:02FromDiscord<Rika> What you showed is not that
10:12:19FromDiscord<Rika> You showed a literal getting bound to a variable then being passed into a function
10:12:23FromDiscord<Elegantbeef> The compiler is backwards reasoning the type of `b` just find
10:12:31FromDiscord<Elegantbeef> Look at the type it reasoned `b` to
10:12:35FromDiscord<Elegantbeef> `u8`
10:12:41FromDiscord<Rika> Yes
10:12:43FromDiscord<Rika> Is that wrong?
10:13:07FromDiscord<Rika> Okay
10:13:10FromDiscord<Rika> I see your point
10:13:11FromDiscord<Elegantbeef> It's right, but i find it odd that it doesnt do it for a aswell since it's a literal
10:13:59FromDiscord<Rika> Well I think because integer to integer is always reversible unless you exceed the size of the destination
10:14:06FromDiscord<Rika> Whilst it’s not true for the other
10:14:20FromDiscord<Elegantbeef> Possibly, i find the behaviour odd still
10:14:56FromDiscord<Elegantbeef> You have this backwards type inference but only use it for some literals, seems counter to what one would expect
10:16:08FromDiscord<Schelz> I have a question why C code returns me wired numbers in nim print ?
10:16:21FromDiscord<Elegantbeef> Also that's the first rust code i've ever written, oh how the might have fallen
10:16:34FromDiscord<Elegantbeef> What's the code schelz?
10:16:37FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/914097372102012948/unknown.png
10:16:43FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/914097394751262720/unknown.png
10:17:05FromDiscord<Schelz> returns numbers like: 6289996, 10747340, 20970220
10:17:07FromDiscord<Schelz> etc..
10:17:18FromDiscord<Elegantbeef> One second let me recreate it
10:17:28FromDiscord<Elegantbeef> Oh you use `int` instead of `cint`
10:17:31FromDiscord<Elegantbeef> Could be an issue
10:18:25FromDiscord<Schelz> change to cint {.importc.} nothing changed
10:18:52FromDiscord<Schelz> (edit) "change" => "I changed " | "I changed to cint {.importc.} nothing changed ... " added "still weird numbers"
10:18:52FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Gfp works fine here
10:19:17FromDiscord<Schelz> lol
10:20:48FromDiscord<Schelz> I copied the code in the files nothing lol...
10:20:54FromDiscord<Elegantbeef> I dont know what to say
10:21:05FromDiscord<Elegantbeef> Wait did the code i give you not work?
10:21:09FromDiscord<Rika> Are you on windows
10:21:18FromDiscord<Rika> Maybe that would matter but it really shouldn’t
10:21:37FromDiscord<Elegantbeef> `nim -v`
10:21:48FromDiscord<Elegantbeef> There has to be something we're missing
10:22:04FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/914098743199023144/unknown.png
10:22:13FromDiscord<Elegantbeef> Cause the only thing that makes sense is that you're not initialising values on C, but if that's the function that's not an issue
10:22:26FromDiscord<Elegantbeef> windows 32bit
10:22:44FromDiscord<Elegantbeef> So the code i gave you also failed?
10:23:03FromDiscord<Rika> It should still work even on 32 bit thoughhhhhh
10:23:24FromDiscord<Elegantbeef> Indeed
10:24:16FromDiscord<Schelz> In reply to @Elegantbeef "So the code i": yes
10:24:28FromDiscord<Rika> That is seriously strange
10:24:58FromDiscord<Elegantbeef> Does the compiled C work properly?
10:25:30FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Gfs
10:25:38FromDiscord<Elegantbeef> Although i assume you could've written that yourself 😀
10:25:56FromDiscord<Rika> What if Nim thinks it’s 32 bit but the compiler is 64?
10:25:58FromDiscord<Elegantbeef> I can only imagine the 32bit nim compiler is shitting the bed, or there is an issue with your C compiler
10:26:31FromDiscord<Schelz> returns 88 and 66 https://media.discordapp.net/attachments/371759389889003532/914099857650761778/unknown.png
10:26:46FromDiscord<Rika> That’s correct then
10:26:57FromDiscord<Rika> 8 from print and another 8 from echo
10:26:59FromDiscord<Elegantbeef> Ok so we're in a proper universe
10:27:14FromDiscord<Rika> Lol
10:27:47NimEventerNew thread by Mantielero: Importcpp constructor issue, see https://forum.nim-lang.org/t/8660
10:29:37FromDiscord<Elegantbeef> I'm now confused why the other errored, is cint on 32bit not a 32bit int?
10:31:03FromDiscord<Schelz> lame its from cint {.importC, nodecl.} it has to be nodecl. too in order to work
10:31:27FromDiscord<Schelz> else its printing random numbers
10:31:37FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/914101146002550824/unknown.png
10:32:20FromDiscord<Elegantbeef> you probably could just do `importc, header: "importex.c"`
10:32:40FromDiscord<Elegantbeef> then you wouldnt need the `{.compile: ... .}`
10:32:48FromDiscord<Elegantbeef> Atleast i dont think so
10:33:22FromDiscord<Elegantbeef> Eh probably dumb, to do that
10:33:24FromDiscord<Schelz> aha its working that way too
10:33:37FromDiscord<Schelz> works good https://media.discordapp.net/attachments/371759389889003532/914101649964929054/unknown.png
10:34:29FromDiscord<Elegantbeef> Well if you have more functions you might want to do `{.push importc header:"importex.c".}` and a `{.pop.}` after
10:35:47FromDiscord<Schelz> thx
11:04:09*lumo_e quit (Remote host closed the connection)
11:05:26*lumo_e joined #nim
11:14:24*src joined #nim
11:19:59NimEventerNew thread by Lachu: Turn of name mangling for Nim type, while exporting to c, see https://forum.nim-lang.org/t/8661
11:29:33*src quit (Quit: Leaving)
11:30:25*src joined #nim
11:35:40*src quit (Quit: Leaving)
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:55*supakeen joined #nim
12:18:32*lumo_e quit (Ping timeout: 268 seconds)
12:25:21*neurocyte0132889 joined #nim
12:25:21*neurocyte0132889 quit (Changing host)
12:25:21*neurocyte0132889 joined #nim
12:32:28*PMunch joined #nim
12:58:43FromDiscord<lantos> @Yardanico
13:10:02FromDiscord<5271> how do i read a single character?↵like readKey
13:11:57FromDiscord<lantos> @cheatfate
13:12:05FromDiscord<lantos> (edit) "@cheatfate ... " added "on discord?"
13:12:12FromDiscord<lantos> (edit)
13:12:21FromDiscord<lantos> (edit) "@cheatfate" => "cheatfate"
13:12:28FromDiscord<lantos> (edit) "cheatfate" => "@cheatfate"
13:13:36*lumo_e joined #nim
13:19:10FromDiscord<gdquest> sent a code paste, see https://play.nim-lang.org/#ix=3Ggc
13:20:29FromDiscord<gdquest> sent a code paste, see https://play.nim-lang.org/#ix=3Ggd
13:20:33FromDiscord<Rika> notin
13:20:35FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Gge
13:20:37FromDiscord<enthus1ast> if not found -1
13:20:59FromDiscord<Rika> `if character notin ...`
13:21:03FromDiscord<gdquest> Ah! `notin`, yes
13:21:12FromDiscord<gdquest> It's a bit like everything works like procedures?
13:21:14FromDiscord<Rika> if you prefer you can always `not_in`
13:21:26FromDiscord<gdquest> And thanks @enthus1iast too
13:23:22FromDiscord<gdquest> It's going very well working with nim already. I'm coding a formatter for my team and it's fairly straightforward so far
13:30:32*terminalpusher joined #nim
13:36:09*lumo_e quit (Ping timeout: 250 seconds)
13:52:32*mahlon quit (Ping timeout: 256 seconds)
13:55:15*terminalpusher quit (Remote host closed the connection)
13:59:17FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=3Ggo
14:04:17*anddam quit (Quit: WeeChat 3.3)
14:14:54*arkurious joined #nim
14:54:10*mahlon joined #nim
15:00:08*anddam joined #nim
15:07:59*lumo_e joined #nim
15:13:51FromDiscord<tandy> can you do a deepcopy in nim?
15:13:52FromDiscord<tandy> like in python?
15:14:03FromDiscord<Rika> yes
15:14:07FromDiscord<tandy> i have a seq[seq[ref object]
15:14:15FromDiscord<tandy> and x = y isnt working
15:14:24FromDiscord<Rika> deepcopy()
15:14:25FromDiscord<tandy> well it copies but changes are carried over to y
15:14:28FromDiscord<Rika> x = y is shallow
15:14:53FromDiscord<Rika> deep copies are explicit
15:17:24FromDiscord<tandy> oh epic it works
15:19:47FromDiscord<tandy> oh shit does `deepcopy` work with emscripten ?
15:21:54FromDiscord<tandy> yees it compiles
16:01:32FromDiscord<Rika> well deepcopy is a magic
16:01:42FromDiscord<Rika> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L2960
16:14:43*lumo_e quit (Ping timeout: 268 seconds)
16:15:20*lumo_e joined #nim
16:20:11FromDiscord<gdquest> Wow!
16:20:35FromDiscord<gdquest> I must say, the ability to jump to definition with the standard library is so cool 🙂
16:21:09FromDiscord<gdquest> How would you go about something like this in nim? This is Python `"\t" indent_level + "#" dash_count + wrapped_line`
16:21:52FromDiscord<gdquest> So I'm doing it the simple way, with a for loop right now, but I was wondering if there's something different or more idiomatic
16:23:16FromDiscord<haxscramper> `import std/strutils; repeat("$", dashCount)`
16:23:23FromDiscord<enthus1ast> well there is align↵↵https://nim-lang.org/docs/strutils.html#align%2Cstring%2CNatural%2Cchar
16:27:55FromDiscord<gdquest> Perfect, thanks!
16:30:09FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Ghb
16:30:10FromDiscord<gdquest> sent a code paste, see https://paste.rs/Qf7
16:30:39FromDiscord<gdquest> Yes it's great you can make functions like that, although I'm avoiding sugar for now to get used to the Nim operators and functions
16:31:27FromDiscord<gdquest> (edit) "https://play.nim-lang.org/#ix=3Ghd" => "https://play.nim-lang.org/#ix=3Ghc"
17:19:12*lumo_e quit (Ping timeout: 260 seconds)
17:28:16FromDiscord<tandy> how can i debug illegal storage access error?
17:28:37FromDiscord<enthus1ast> have a closer look at your ref or pointer types
17:29:28FromDiscord<enthus1ast> u prolly try to use a unititialized ref
17:30:13FromDiscord<enthus1ast> btw JsonNode is ref
17:40:13*lumo_e joined #nim
17:46:11*lumo_e quit (Ping timeout: 250 seconds)
17:47:27*lumo_e joined #nim
17:53:30FromDiscord<tandy> hmmm i tried
17:53:34FromDiscord<tandy> big project those
17:55:00FromDiscord<enthus1ast> you could use gdb to find this, but i have not much experience with nim and gdb, so others might comment on this
17:56:03FromDiscord<enthus1ast> but i think its something along those lines\:↵compile with --debugger\:native↵run with gdb until it crashes↵see the stacktrace
17:56:35*lumo_e quit (Ping timeout: 250 seconds)
17:57:37*lumo_e joined #nim
17:59:03FromDiscord<tandy> https://internet-of-tomohiro.netlify.app/nim/gdb.en.html
17:59:03FromDiscord<tandy> i found this
17:59:53FromDiscord<enthus1ast> yes
18:03:30FromDiscord<enthus1ast> yeah at least in this example it picks it up easily
18:03:31FromDiscord<enthus1ast> https://play.nim-lang.org/#ix=3GhH
18:04:43FromDiscord<tandy> `/home/tandy/.nimble/tools/nim-gdb.py: No such file or directory.`
18:04:52FromDiscord<tandy> when i run nim-gdb on the compiled file
18:05:47FromDiscord<enthus1ast> imho you can try it withouth the nim specific scripts
18:06:15FromDiscord<enthus1ast> should be enough to find it
18:06:25FromDiscord<enthus1ast> but you can always source the correct python script
18:06:44FromDiscord<tandy> `nim c --debugger:native tests/test.nim` just compiles and does nothing
18:06:56FromDiscord<enthus1ast> yes
18:07:04FromDiscord<enthus1ast> please have a look at my example
18:07:09FromDiscord<enthus1ast> you must run it with gdb
18:07:15FromDiscord<enthus1ast> gdb test.exe
18:07:37FromDiscord<tandy> yes i try that here
18:07:41FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3GhI
18:07:51FromDiscord<tandy> oh il try this
18:08:26FromDiscord<enthus1ast> then just run you programm until it crashes with\:↵r
18:08:48FromDiscord<enthus1ast> r{enter}
18:10:10FromDiscord<enthus1ast> imho the nim-gdb.py stuff is just to print variables better
18:10:25FromDiscord<enthus1ast> but you should be able to see the line where it crashes even withouth this
18:15:53FromDiscord<tandy> hmm its kinda useful
18:15:57FromDiscord<tandy> but yea ur right
18:16:09FromDiscord<tandy> i dont understnad why the var is uninitialised tho
18:16:57FromDiscord<enthus1ast> can you share code?
18:17:14FromDiscord<tandy> yeah its here
18:18:53FromDiscord<tandy> https://github.com/tandy-1000/minmax-checkers just pushed
18:19:07FromDiscord<tandy> the error is in `minimax`
18:19:15FromDiscord<tandy> im trying to make the tests work
18:19:26FromDiscord<tandy> you can run `nimble test`
18:19:55FromDiscord<enthus1ast> on which line it crashes?
18:20:09FromDiscord<enthus1ast> maybe send a github link
18:20:44FromDiscord<tandy> https://github.com/tandy-1000/minmax-checkers/blob/cb3c9ce6f7144505c0fcdb26b3bbc40caac052a8/src/classes.nim#L408
18:21:11FromDiscord<tandy> i think the reason could be that minimax doesnt return any move in certain ocasions?
18:21:57FromDiscord<enthus1ast> oh you use some oop macros
18:22:18FromDiscord<tandy> yep
18:23:24FromDiscord<enthus1ast> if it can, and if it does in this case, this might be your error
18:23:40FromDiscord<tandy> i wonder how i can find that out
18:24:07FromDiscord<enthus1ast> echo "here"USE THE MOVE↵echo "there"\:D
18:24:46FromDiscord<tandy> oh i fixed it lol
18:27:29FromDiscord<tandy> ty ! minimax still maxes debug call depth so i got more work to do lol
18:33:41*lumo_e quit (Ping timeout: 245 seconds)
18:59:18FromDiscord<IsaacPaul> In reply to @fishcakenine "I am trying to": @fishcakenine .. not sure how to ping people on irc or gitter.. but hopefully this works lol. Did you ever finish your wgpu-native wrapper?
19:03:01*Figworm quit (Quit: Figworm)
19:03:57*krux02 joined #nim
19:20:23*src joined #nim
19:23:34*lumo_e joined #nim
19:29:30*src quit (Read error: Connection reset by peer)
19:29:54*src joined #nim
19:30:08*src quit (Remote host closed the connection)
20:37:47*lumo_e quit (Ping timeout: 250 seconds)
21:01:41arkanoidam I the only one receiving http 500 error here? https://github.com/yglukhov/nimpy
21:02:11FromDiscord<enthus1ast> nope
21:02:12FromDiscord<enthus1ast> 500
21:02:23FromDiscord<enthus1ast> for me aswell
21:02:48arkanoidyglukhov hacked github with the power of nimpy
21:04:04arkanoidoh well, is massive https://www.githubstatus.com/
21:10:33arkanoiddo you tend to "import" or "include" the tested module X into your test_X.nim ?
21:33:30arkanoidI'm realizing how many different things in the world are named nim* nimble* nimpy* thanks to github being down
21:36:08FromDiscord<evoalg> regarding deepcopy which was mentioned above, when would I use that in Nim instead of normal copy ... I though containers in Nim were copied by value anyway?
21:36:28arkanoidwhat's the equivalent of "--app:lib" in .nimble file?
21:39:07FromDiscord<pyautogui> Github appears to be down for everybody. Twitter is memeing like crazy about it. Kind of sucks.
21:39:13FromDiscord<Recruit_main707> arkanoid: i think there is a way but i dont remember it right now, you can use a .nims file too and do `switch("app", "lib")`, lemme search and see if i can find a way to do it in the nimble file
21:40:12FromDiscord<Recruit_main707> I think there isnt
21:40:42FromDiscord<Recruit_main707> but what i said will work
21:41:31FromDiscord<Recruit_main707> so if you have a a `src/main.nim` file, add a `src/main.nims` file with that switch
21:44:25arkanoidyes it works, thanks
21:49:30*xet7 quit (Remote host closed the connection)
21:50:34*xet7 joined #nim
21:51:48FromDiscord<pyautogui> GH is back up.
21:53:27arkanoidyes
21:54:45arkanoidwell, almost
22:08:34*src joined #nim
22:11:53*src quit (Client Quit)
22:14:48*perro joined #nim
22:26:28*xet7 quit (Quit: Leaving)
22:26:52*xet7 joined #nim
22:36:57FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3Giy
22:37:03FromDiscord<codic> It seems just calling self.focused.isSome causes it to crash
22:37:15FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3Giz
22:37:20FromDiscord<codic> 734 is the last line in the code snippet I posted
22:37:26FromDiscord<codic> Where is -1 coming from
22:38:14FromDiscord<codic> Oh nvm the trace is wrong
22:49:22FromDiscord<Varriount> What's the current state of CPS (continuation-passing style) for asynchronous programming in Nim?
22:50:20FromDiscord<Elegantbeef> The CPS folks have a bunch of demo projects, so it works 😀
22:53:17FromDiscord<codic> Fixed the issue but is the trace pointing to the wrong line a compiler bug?
22:54:12FromDiscord<konsumlamm> In reply to @Varriount "What's the current state": https://github.com/nim-works/cps
22:54:19FromDiscord<konsumlamm> the readme says it's beta quality
22:58:48*k0ta joined #nim
23:16:17FromDiscord<evoalg> @ElegantBeef I'm noob and naive, but is there are way for Nim to completely change the default way slices work, so a slice would return an iterator unless a copy is needed? (a copy would be needed for `let a = "hello"[1..3]`) but it would return an iterator when needed, and also `for i, x in` would work? I'm trying to understand if Nim didn't do some of the iterators early on when it was being created and so iterators need to be "bolted on
23:17:57FromDiscord<Elegantbeef> Well i mean that's what it's supposed to do, the issue is that nim doesnt dispatch on return types
23:18:47*Onionhammer quit (Ping timeout: 250 seconds)
23:18:49FromDiscord<Elegantbeef> so when you do `iterator [](a: openarray, rng: slice[int]): T` and `iterator [](a: openarray, rng: slice[int]): (int, T)` it cannot disambiguate the two iterators
23:19:35FromDiscord<Elegantbeef> so in the case of the fun `for i, x in "hello"[0..^2]` it calls the `[]` iterator and since we can only have one it cannot be used with pairs
23:19:36FromDiscord<Varriount> In reply to @evoalg "<@!145405730571288577> I'm noob and": `
23:20:43FromDiscord<Elegantbeef> The only issue we have with my package is that `for i, x in "hello"[0..^2]` calls my `[]` iterator that doesnt return a tuple, which means we have an error as we're attempting to unpack a T into two values
23:21:14FromDiscord<Elegantbeef> And actually your example is wrong, since a copy is only needed if you mutate the value
23:21:44FromDiscord<Elegantbeef> So you can do a reference aslong as you know the variable stays within scope of another and doesnt mutate
23:22:01FromDiscord<Elegantbeef> But that's an optimization
23:22:22FromDiscord<Elegantbeef> Hopefully that makes sense
23:23:09FromDiscord<Elegantbeef> Like i said i can remove the ambiguity 100% but then the ergonomics get shit
23:23:30FromDiscord<Elegantbeef> like `for i, x in "hello"[&0..^2]` solves the problem
23:23:51FromDiscord<Elegantbeef> But now we have to use `&` for pairs
23:24:56FromDiscord<evoalg> it does thank you! ... apart from the last bit ... so the assignment `a = "hello"[1..3]` could have an iterator assigned to it? ... so that would be an iterator not a range? I'm a bit confused about assigning a slice to a variable when it's an iterator?
23:25:16FromDiscord<Elegantbeef> Only closure iterators are assignable to variables
23:25:23FromDiscord<Elegantbeef> So it'd never call the iterator since it's not a closure
23:25:47FromDiscord<Elegantbeef> Only in `for` context is an iterator preferred over a function
23:25:57FromDiscord<Elegantbeef> Which is what slicerator relies upon
23:26:03FromDiscord<evoalg> ahh
23:27:58FromDiscord<Elegantbeef> Alternatively we could do `for i, x in "hello"[&(0..^2)]` 😛
23:28:30FromDiscord<Elegantbeef> I dont know we need something to nicely disambiguate the pairs from the normal iterator
23:28:58FromDiscord<Elegantbeef> Cause i really dont care that `for i, x in "hello"[0..^2]` errors, cause it's bad anyway
23:29:28FromDiscord<evoalg> Thank you, I understand the problem now ... I don't know what the answer is, but as least I understand the problem!
23:29:53FromDiscord<Elegantbeef> Yea i mean it's really just a question of do we want to use distincts or `pairs(range)`
23:29:54FromDiscord<evoalg> oh that's bad? ... how would you do `for i, x in` instead?
23:30:08FromDiscord<Elegantbeef> Well it's bad cause it relies on sequence slicing
23:30:43FromDiscord<Elegantbeef> So if you have a large string and you do that to it you're needlessly taking more ram and slowing the program
23:31:24FromDiscord<Elegantbeef> The iteration isnt the issue as much as the fact it's abusing slicing and implicit pairs like i mentioned yesterday
23:31:27FromDiscord<evoalg> "sequence slicing" is making a copy?
23:31:34FromDiscord<Elegantbeef> Yep
23:31:59FromDiscord<Elegantbeef> `for i, x in "hello"[0..^2]` is turned into `for i, x in "hell".pairs`
23:32:07FromDiscord<Elegantbeef> And creation of `"hell"` is an allocation
23:32:34FromDiscord<evoalg> that's hell
23:35:00meowray`create(T)` does not set m_type so `T of BaseOfT` does not work. How to set m_type?
23:35:53meowray`var a = create(T); a = T()` sets m_type but the redundant assignment looks bad
23:36:40FromDiscord<Elegantbeef> do you have a full example?
23:37:03FromDiscord<Ricky Spanish> how do you define an object that has a string array as a field? it seems to be unhappy when i use []string, seq[string] works but not really what i was aiming for
23:37:32FromDiscord<Elegantbeef> Arrays in nim are dependent types so it's `field: array[Length, string]`
23:37:50FromDiscord<Ricky Spanish> ah ok thanks for explaining @ElegantBeef
23:37:54FromDiscord<Elegantbeef> If you do not know the length at compile time you do not use an array
23:38:00FromDiscord<Elegantbeef> Or you do but make it larger than you'll need
23:40:14FromDiscord<MaskRay (Fangrui Song)> sent a code paste, see https://play.nim-lang.org/#ix=3GiP
23:41:38*src joined #nim
23:41:51*src quit (Remote host closed the connection)
23:42:55FromDiscord<Elegantbeef> You've jumped three programs in 10 seconds 😛
23:43:14FromDiscord<Elegantbeef> Is there a reason you're using `create` over a reference?
23:43:54FromDiscord<@MaskRay:matrix.org> (I realized that IRC is bad for pasting program... Then I thought I might try Gitter, but finalized I realized most people seem to use Matrix... So I dug up my app.element.io account which has been used for a while..)
23:44:06FromDiscord<Elegantbeef> Well gitter is matrix now so ya 😛
23:44:55FromDiscord<@MaskRay:matrix.org> I want to do raw memory management without GC, so I want to avoid `ref`. I still need `instanceof`, though...
23:45:10FromDiscord<Elegantbeef> Ah i see, was uncertain what you were after so thought i'd ask
23:45:29FromDiscord<Elegantbeef> I assume there is lacking type information from `create` since it just dumbly 0's memory
23:46:53FromDiscord<@MaskRay:matrix.org> Yes. According to `nim c --gc:arc -d:debug --debugger:on a; rr record ./a; rr replay -d cgdb`, `create` allocated memory does not have valid `m_type`. `b[] = InputSection()` will set `m_type`, but the redundant assignment is bad.
23:47:05*PMunch quit (Quit: leaving)
23:47:18FromDiscord<Elegantbeef> Might be the way to do it
23:47:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GiQ
23:47:52FromDiscord<Elegantbeef> You of course can do `createU` in this case since you're setting it after
23:48:06FromDiscord<Elegantbeef> So it shouldnt be any more costly, or negligibly more costly
23:48:39FromDiscord<Elegantbeef> Actually that caching is useless
23:48:40FromDiscord<Elegantbeef> I'm dumb
23:49:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GiS
23:50:40FromDiscord<@MaskRay:matrix.org> sent a code paste, see https://play.nim-lang.org/#ix=3GiT
23:50:49FromDiscord<Elegantbeef> Yea that also works, if you never want to pass an expression
23:50:54FromDiscord<pmunch> Generally a good idea to do the caching though [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)
23:51:05FromDiscord<Elegantbeef> Well it doesnt matter in this case
23:51:24FromDiscord<Elegantbeef> `typeof(default)` is a compile time evaluated statement, and you only use default after i t
23:51:26FromDiscord<pmunch> Sure, but it's good that you're showing it to people
23:51:35FromDiscord<Elegantbeef> Ah yes
23:53:47FromDiscord<Elegantbeef> @evoalg\: if you ever want to play with "how bad is it really" this is fun https://play.nim-lang.org/#ix=3GiW
23:54:01FromDiscord<Elegantbeef> Though slicerator was dumbly using `toOpenArray` which slowed it down like 5ns
23:54:23FromDiscord<Elegantbeef> But naive is like 3 times slower than slicerator/manual
23:54:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GiX
23:56:27FromDiscord<Elegantbeef> This of course gets worse the larger the sequence is