<< 17-03-2021 >>

00:34:38*vsantana quit (Ping timeout: 245 seconds)
00:38:34*vsantana joined #nim
01:01:54*Tanger joined #nim
01:04:20*blackpawn quit (Ping timeout: 256 seconds)
01:04:35*Tlangir joined #nim
01:07:09*Tanger quit (Ping timeout: 265 seconds)
01:12:56*blackpawn joined #nim
01:14:32FromDiscord<Livingstone> sent a long message, see http://ix.io/2T7T
01:14:46FromDiscord<Livingstone> (edit) "http://ix.io/2T7T" => "http://ix.io/2T7U"
01:15:00FromDiscord<Livingstone> (edit) "long message," => "code paste," | "http://ix.io/2T7U" => "https://play.nim-lang.org/#ix=2T7V"
01:15:12FromDiscord<Livingstone> so I'm getting a data type issue with the delete routine
01:15:48FromDiscord<Livingstone> Error: type mismatch: got <seq[float], float>โ†ตbut expected one of:
01:16:09FromDiscord<Livingstone> anyone know how to clear a sequence so it can be reloaded?
01:18:05FromDiscord<ElegantBeef> @Livingstone `hold.SetLen(0)`
01:18:08FromDiscord<ElegantBeef> (edit) "`hold.SetLen(0)`" => "`hold.setLen(0)`"
01:18:21FromDiscord<Hi02Hi> or `reset(hold)` right?
01:18:39FromDiscord<ElegantBeef> Reset would probably also reset the capacity
01:18:51FromDiscord<ElegantBeef> So that would make it reallocate to the present size
01:19:16FromDiscord<ElegantBeef> Atleast i wouldnt use reset on a seq
01:19:56FromDiscord<Livingstone> and what is the routine to add a value to a sequence?
01:20:17FromDiscord<ElegantBeef> `.add`
01:20:23FromDiscord<ElegantBeef> you used it in the code ๐Ÿ˜„
01:20:56FromDiscord<Hi02Hi> either way, shouldnt @Livingstone sayโ†ต`var dataset: seq[seq[float]]`โ†ตor maybeโ†ต`var dataset = newSeq[seq[float]](1)` ?
01:21:22FromDiscord<Hi02Hi> instead of adding and deleteing?
01:22:09FromDiscord<Livingstone> In reply to @ElegantBeef "you used it in": yeh there is an issue with data type there as well which is why I was wondering if I did it wrong like the delete routine
01:22:51FromDiscord<Livingstone> In reply to @Hi02Hi "either way, shouldnt <@!263060627793248278>": also elegant was the one who made me change it from seq[seq[float]
01:22:59FromDiscord<Livingstone> (edit) "seq[seq[float]" => "seq[seq[float]]"
01:24:06FromDiscord<Livingstone> basically if anyone knows how to take a csv file and change it to a seq[seq[float]] I'm open
01:24:33FromDiscord<Livingstone> If I'm missing something super simple like a module please tell me
01:30:15*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:30:33*njoseph joined #nim
01:31:18FromDiscord<Livingstone> new question how to change a string to a float
01:39:07FromDiscord<Hi02Hi> strutils/parseFloat
01:39:16FromDiscord<Hi02Hi> (edit) "strutils/parseFloat" => "std/strutils/parseFloat"
01:40:23FromDiscord<Kiloneie> For such basic questions, maybe my videos could help you out ๐Ÿ˜›
01:49:11*blitzworks joined #nim
01:50:35FromGitter<ynfle> @Livingstone โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=6051606b28e6153d722395f1]
02:08:53FromDiscord<Livingstone> In reply to @ynfle "<@263060627793248278> โŽ โŽ": that's to make a csv not unpack one but I got it to work so it's fine
02:23:29FromDiscord<ajusa> Anyone know why this is happening to me? `error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher [SslError]`, when trying to wrap a client connection in an ssl context
02:24:10FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2T8n
02:38:26FromDiscord<ajusa> Figured it out, you actually need a certFile and a keyFile even if you have the certificate checks disabled, I think that only affects it client side? โ†ต`var ssl = newContext(certFile="mycert.pem", keyFile="mykey.pem")`
02:41:25FromDiscord<Livingstone> I'm having an issue with line 33 https://play.nim-lang.org/#ix=2T8r, it's not giving me a complete error it just says Error: 'row[i]' cannot be assigned to
02:44:35FromDiscord<ElegantBeef> Yep that's a valid error
02:44:55FromDiscord<ElegantBeef> In nim for loops by default call `items` which is almost always an immutable reference
02:45:24FromDiscord<ElegantBeef> For that to work the parameter needs to be a `var seq[seq[float]]`
02:45:40FromDiscord<ElegantBeef> Also to save you time you can doโ†ต`type DataSet = seq[seq[float]]`
02:46:32FromDiscord<ElegantBeef> if you want a mutable reference you need to do `dataset.mitems`
02:47:34FromDiscord<ElegantBeef> Have you went through the tutorials?
02:48:13FromDiscord<ElegantBeef> If not i high suggest reading over https://nim-lang.org/docs/tut1.html
02:50:33FromDiscord<Livingstone> yeah I used mitems before but it conflicted with the datatype as it requires dataset to be set as var as opposed to seq[seq[float]]
02:50:47FromDiscord<ElegantBeef> Well yea you want to mutate `dataset`
02:51:33FromDiscord<ElegantBeef> Nim's `items` and `mitems` are zero cost iterators so they do nothing but iterate over the values directly
02:52:07*chaulkim joined #nim
02:52:15chaulkimGreetings fellow nimsters
02:52:30FromDiscord<ElegantBeef> The colloquial term is nimions ๐Ÿ˜›
02:52:37chaulkimoh lol
02:52:39chaulkimDear GOD/GODS and/or anyone else who can HELP ME (e.g. MEMBERS OF SUPER-INTELLIGENT ALIEN CIVILIZATIONS):
02:52:39chaulkimThe next time I wake up, please change my physical form to that of FINN MCMILLAN of SOUTH NEW BRIGHTON at 8 YEARS OLD and keep it that way FOREVER.
02:52:40chaulkimI am so sick of this chubby Asian man body!
02:52:40chaulkimThank you!
02:52:41chaulkim- CHAUL JHIN KIM (a.k.a. A DESPERATE SOUL)
02:52:41*chaulkim left #nim (#nim)
02:53:03FromDiscord<ElegantBeef> Who wants to deal with this
02:53:48Prestigehe left
02:53:54FromDiscord<ElegantBeef> Yea i noticed
02:54:17FromDiscord<Livingstone> weird
02:54:23FromDiscord<ElegantBeef> What's even the point of spamming shit like that
02:55:13FromDiscord<ElegantBeef> I can understand self promotion but that was a human connecting posting that then having a giggle, over the supposed idea of our reaction i assume
02:55:48FromDiscord<Livingstone> confessions of a disturbed man
02:56:13FromDiscord<ElegantBeef> Anyway
02:56:21FromDiscord<ElegantBeef> Livingstone do you understand? ๐Ÿ˜„
02:56:30FromDiscord<ElegantBeef> Also worth noting you dont touch the result of the procedure
02:57:00FromDiscord<ElegantBeef> Do you mean to add the right hand of that equal sign to the result?
02:57:29*a_b_m quit (Quit: Leaving)
02:58:19FromDiscord<Livingstone> I don't think so
02:58:46FromDiscord<ElegantBeef> Which part?
03:00:47FromDiscord<Livingstone> the add the right hand of the equal sign to the result
03:01:04FromDiscord<Livingstone> does everything under the proc count as the right hand side
03:01:19FromDiscord<ElegantBeef> ah instead of `rows[i]` do you mean to do `result.add (row[i] - minmax[i][0])/(minmax[i][1] - minmax[i][0])`
03:01:42FromDiscord<ElegantBeef> You presently are not using the `result`
03:02:09FromDiscord<ElegantBeef> Nim creates an implict result value
03:02:40FromDiscord<Livingstone> this is the python code
03:02:45FromDiscord<Livingstone> to give us insight
03:02:46FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T8v
03:02:50FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/K2X
03:02:58FromDiscord<ElegantBeef> Ok so then yes you want the dataset to be `var Dataset`
03:03:27FromDiscord<ElegantBeef> I'm half tempted to refactor this for you just so you can see the more idiomatic version ๐Ÿ˜›
03:03:36FromDiscord<ElegantBeef> Just so we can actually get that done simpler
03:04:26FromDiscord<Livingstone> so how can dataset be two data types at once or is that just initializing it for the procedure
03:04:41FromDiscord<Livingstone> (edit) "so how can dataset be two data types at once or is that just initializing it for the procedure" => "I'm stupid"
03:04:41FromDiscord<ElegantBeef> I'm just going to refactor this quickly
03:08:19FromDiscord<ElegantBeef> Here we go https://play.nim-lang.org/#ix=2T8w
03:08:34FromDiscord<ElegantBeef> Aw missed on `seq[seq[float]]`
03:08:38FromDiscord<ElegantBeef> (edit) "on" => "one"
03:13:12FromDiscord<Livingstone> did you leave out .mitems by mistake or on purpose
03:13:21FromDiscord<Livingstone> oh wait this is my old coe
03:13:22FromDiscord<ElegantBeef> I was getting it to the same place
03:13:32FromDiscord<Livingstone> (edit) "coe" => "code"
03:17:13FromDiscord<ElegantBeef> Ok here we go almost compilable refactor
03:17:14FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2T8B
03:17:44FromDiscord<ElegantBeef> @Livingstone if you notice i removed the return type on `normalize` and removed `dataset` from the name since both are redundant.
03:18:09FromDiscord<ElegantBeef> The python code i assume worked the same by mutating the parameter which is why we need mitems + var
03:28:18FromDiscord<Livingstone> do you see the error that you get when you compile the code, error on line 102 is that because l_rate needs to be float64 type?
03:29:07FromDiscord<ElegantBeef> Well the 4th argument in the `evaluateAlgorithim` is a `tuple`
03:29:30FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/g3V
03:32:18FromDiscord<Gary M> sup beef
03:32:27FromDiscord<Gary M> what are you currently working on
03:32:48FromDiscord<ElegantBeef> Exactly now?
03:32:50FromDiscord<ElegantBeef> Nothing
03:32:55FromDiscord<Gary M> jackass
03:32:56FromDiscord<Gary M> lol
03:32:58FromDiscord<ElegantBeef> Lol
03:33:00FromDiscord<Gary M> you know what I mean
03:33:04FromDiscord<ElegantBeef> Still got my eyes on the pico-sdk
03:33:57FromDiscord<Livingstone> should I just break up that args into l_rate and n_epoch
03:34:12FromDiscord<ElegantBeef> Probably, though it's purely up to you
03:34:27FromDiscord<ElegantBeef> Generally you dont use `tuple` as a parameter type like that
03:34:51FromDiscord<Gary M> I need to use `result` more than return lol
03:35:04FromDiscord<ElegantBeef> Indeed
03:35:19FromDiscord<Gary M> it's just different from basically every other language I've done
03:35:30FromDiscord<ElegantBeef> Yea, but implicit result is fantastic
03:35:38FromDiscord<Gary M> or I should say every language I've worked with
03:35:50FromDiscord<Gary M> it's interesting, at least
03:37:08FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2T8F
03:37:19FromDiscord<ElegantBeef> Well if it's not a one line return it's almost certainly going to have a new init'd value
03:37:42FromDiscord<ElegantBeef> You dont even need to set `pNext` it's a nilable type it defaults to nil
03:38:22FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2T8G
03:38:31FromDiscord<Gary M> it's customary to set pNext anyways ๐Ÿ˜„
03:39:51FromDiscord<Gary M> I've found these all work totally fine without initializing like `var info = VkPipelineInputAssemblyStateCreateInfo()`
03:40:05FromDiscord<Gary M> so setting the fields on result just works fine
03:40:38FromDiscord<ElegantBeef> Yea since the return type is a value type
03:40:47FromDiscord<ElegantBeef> if it's not you typically do `new result`
03:42:23FromDiscord<Gary M> I wish there were default initializers on object fields, but I know that was already thoroughly argued about.
03:42:54FromDiscord<Gary M> I mean I guess there's your library for that
03:43:14FromDiscord<ElegantBeef> Well it doesnt handle all types
03:44:12FromDiscord<ElegantBeef> Like variants for instance
03:45:31FromDiscord<Gary M> if nim had default initialization then every single one of these sTypes would be entirely redundant and shave off so many lines ~~just like pNext~~ lol
03:46:50FromDiscord<Gary M> I think I'll just let the pNext init nil what's the worst that can happen, I don't think anything overrides that
03:48:02FromDiscord<ElegantBeef> Hmm i just thought of a new way to make a default constructor
03:48:12FromDiscord<ElegantBeef> ~~Proceeds to see if it works~~
03:48:17FromDiscord<Gary M> do it, coward
03:48:54FromDiscord<Gary M> the only way I currently force it is at module scope having a public proc newObjectIWantDefaultsFor()
03:49:12FromDiscord<ElegantBeef> Yea that's enforced do to how Nim's types work
03:49:23FromDiscord<Gary M> and hiding the ObjectIWantDefaultsFor by default
03:49:24FromDiscord<ElegantBeef> Well it compiles so this can actually work
03:49:38FromDiscord<ElegantBeef> But still requires using `initT`
03:50:54FromDiscord<Gary M> wish you could define the constructor as the same name as the Type but just have the actual C symbol expand like you were writing newT
03:51:01FromDiscord<Gary M> initT/newT
03:51:41FromDiscord<Gary M> because Nim should be able to parse the proc call vs initializer call right?
03:52:13FromDiscord<Gary M> it just doesn't like the redefined symbols
03:53:47FromDiscord<ElegantBeef> Yea i think so
03:54:00FromDiscord<Gary M> could you actually make a macro expand it to initT?
03:54:23FromDiscord<ElegantBeef> I mean mine does
03:54:31FromDiscord<Gary M> say your type is CoolType and you make a proc CoolType() {.newType.}
03:54:52FromDiscord<ElegantBeef> I dont know why you would
03:55:25FromDiscord<Gary M> to have a constructor to call without having a init or new attached to it idk
03:55:32FromDiscord<Gary M> I guess it just wouldn't work that way
03:58:59FromDiscord<Gary M> a render graph sounds fun to implement
03:59:08FromDiscord<Gary M> just use nodes or whatever
04:11:31*spiderstew_ joined #nim
04:13:25*spiderstew quit (Ping timeout: 272 seconds)
04:41:54FromDiscord<Livingstone> How can I have too many arguments when I'm assigning a sequence to a sequence essentially just making a seq[seq[float]] on line 59
04:41:55FromDiscord<Livingstone> https://play.nim-lang.org/#ix=2T8X
04:42:05FromDiscord<Livingstone> (edit) "59" => "59?"
04:46:03FromDiscord<ElegantBeef> Well you're saying `newSeqWith fold` which means nested seq
04:46:19FromDiscord<ElegantBeef> Oh
04:46:23FromDiscord<ElegantBeef> You're using square braces
04:46:42FromDiscord<ElegantBeef> Square braces is for generics
04:46:51FromDiscord<ElegantBeef> Read the tutorial please
04:52:48FromDiscord<Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2T94
04:53:16FromDiscord<Hi02Hi> (edit) "https://play.nim-lang.org/#ix=2T94" => "https://play.nim-lang.org/#ix=2T95"
04:53:20*lritter joined #nim
04:54:29*asdflkj quit (Quit: IRCNow and Forever!)
04:54:36FromDiscord<ElegantBeef> Nim doesnt support default values
04:54:49FromDiscord<ElegantBeef> I am actually currently making a macro to make it a bit easier to do
04:55:15FromDiscord<Hi02Hi> would that be a part of user defined literals?
04:55:33FromDiscord<ElegantBeef> Do not know
04:55:44FromDiscord<ElegantBeef> my macro will be apart of my constructor package
05:01:57*asdflkj joined #nim
05:06:38FromDiscord<ElegantBeef> @Hi02Hi @Gary M ehhh it's nice https://media.discordapp.net/attachments/371759389889003532/821610457009618954/unknown.png
05:07:26*leorize quit (Remote host closed the connection)
05:07:30FromDiscord<Gary M> lol, interesting conversation
05:07:39FromDiscord<ElegantBeef> Indeed
05:07:47FromDiscord<Gary M> it is nice. I might have to steal it for the bootstrapper
05:07:48*leorize joined #nim
05:08:40FromDiscord<Gary M> what's the implDefault(A) required for
05:08:47FromDiscord<ElegantBeef> To actually emit the code
05:08:56FromDiscord<ElegantBeef> Nim's typedef macros cannot emit procedures
05:09:43FromDiscord<Gary M> is `default` a keyword ๐Ÿ˜„
05:09:53FromDiscord<Gary M> implDefault is a handful
05:10:10FromDiscord<Gary M> default A
05:10:19FromDiscord<ElegantBeef> default is a keyword
05:10:22FromDiscord<Gary M> fuck
05:10:34FromDiscord<Gary M> pardon my english
05:10:43FromDiscord<ElegantBeef> though due to the override `defaults` could work
05:12:28FromDiscord<ElegantBeef> Well short of making my own DSL this is the best i can do
05:13:27FromDiscord<ElegantBeef> A nice consequence is you can also do this https://media.discordapp.net/attachments/371759389889003532/821612174279049246/unknown.png
05:13:36FromDiscord<ElegantBeef> inferred type
05:25:33FromDiscord<Livingstone> does anyone know how to delete an element from a sequence
05:27:37FromDiscord<ElegantBeef> `delete` or `del` depending on what you want
05:29:46FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9b
05:30:12FromDiscord<ElegantBeef> del takes an index
05:30:30FromDiscord<ElegantBeef> (edit) "del" => "del/delete"
05:38:25saemHmm, does this have side-effects? https://play.nim-lang.org/#ix=2T9f ๐Ÿค”
05:40:32FromDiscord<ElegantBeef> foo is a global variable
05:40:41FromDiscord<ElegantBeef> Accessing not const variables is considered unsafe
05:40:54FromDiscord<ElegantBeef> (edit) "unsafe" => "impure"
05:41:04FromDiscord<ElegantBeef> Unless of course they're passed to the function
05:41:21saemhmm, so change it to a let would be insufficient?
05:41:26FromDiscord<ElegantBeef> Yep
05:41:41FromDiscord<ElegantBeef> It's not about whether it changes something it's about whether it could
05:41:57saemit made sense once you said the global part.
05:42:10saemI think the thing I don't quite understand is why let doesn't work either.
05:42:28FromDiscord<ElegantBeef> Well lets arent immutable
05:42:41FromDiscord<ElegantBeef> they're addressable so there for you could mutate them
05:42:46saemyou're not immutable!
05:42:49saemgood point
05:43:21FromDiscord<ElegantBeef> Functions and more so strict functions shouldnt touch anything that's not passed to them
05:43:36FromDiscord<ElegantBeef> I assume this is a follow up from yesterday's conversation? ๐Ÿ˜›
05:45:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:45:03saemsomewhat, clyybber and I have heavily refactored semProcAux. I'm trying to figure out what if anything we broke. If anything we've made a lot of things more consistent and fixed bugs. But currently taking stabs at... I wonder what broke and throwing tests in that direction.
05:45:07*njoseph joined #nim
05:45:37saemQuickly figuring out which tests cover what aspects isn't all that easy. Many categories kinda overlap.
05:45:59saemActually, you're pretty darn good at knowing the edges of this stuff, do you think you could give me a hand?
05:47:48FromDiscord<ElegantBeef> I have no clue if i actually can
05:47:55saemI believe in you!
05:47:57saem:D
05:49:57FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9i
05:50:16FromDiscord<ElegantBeef> you can just do `for i, fold in folds` and it'll give you an incremented i
05:50:33FromDiscord<ElegantBeef> Though i dont think that logic is right
05:52:21Prestigeis that paste incomplete?
05:52:36*rockcavera quit (Remote host closed the connection)
05:54:18FromDiscord<Livingstone> yes
06:17:45*narimiran joined #nim
06:26:43*NimBot joined #nim
06:34:13*waleee-cl quit (Quit: Connection closed for inactivity)
06:55:10FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9u
06:55:50FromDiscord<ElegantBeef> Nil is for reference types indicating the memory is empty, it doesnt have `None` if you want to have a non reference which can have no value checkout `options`
06:56:56*vicfred joined #nim
06:56:56FromDiscord<Livingstone> options is none seems to be the obvious one right?
06:57:08FromDiscord<ElegantBeef> Dont know what you mean
06:58:29FromDiscord<Livingstone> for a nim non reference .IsNone is the one I should be looking at?
07:01:05FromDiscord<Gary M> so I have a {.nimcall.} procedure queue implemented as a simple seq
07:01:15FromDiscord<Gary M> and I'm doing this to add them ` mainDeletionQueue &= proc() = vkDestroySwapchainKHR(device, swapchain, nil)โ†ต`
07:01:59FromDiscord<Gary M> which is like, nice enough. I tried to use sugar for the `() =>` syntax, but it doesn't like that without wrapping the entire thing in parenthesis
07:04:06*PMunch joined #nim
07:06:25FromDiscord<Gary M> @Livingstone for a non nullable value type you want to compare it against what the empty value would be, or wrap that in an option
07:06:40FromDiscord<Gary M> .IsNone isn't a default check for every type
07:07:52*GreaseMonkey quit (Remote host closed the connection)
07:09:13ForumUpdaterBotNew thread by Halloleo: Nicer function anmes and other identifiers in the JS output, see https://forum.nim-lang.org/t/7646
07:09:29*greaser|q joined #nim
07:10:33*greaser|q quit (Changing host)
07:10:33*greaser|q joined #nim
07:11:06*greaser|q is now known as GreaseMonkey
07:47:18ForumUpdaterBotNew thread by Hankas: Weird Ref Problem, see https://forum.nim-lang.org/t/7647
08:05:19*Tlangir quit (Quit: Leaving)
08:05:30*fredrikhr joined #nim
08:10:54*vicfred quit (Quit: Leaving)
08:15:21ForumUpdaterBotNew thread by Hankas: Weird Ref Ptr Problem, see https://forum.nim-lang.org/t/7648
08:36:07*haxscramper joined #nim
08:49:01*tanger_ joined #nim
08:51:50*tanger__ quit (Ping timeout: 256 seconds)
09:46:34*tanger__ joined #nim
09:47:41*Gustavo6046 quit (Ping timeout: 244 seconds)
09:55:25*tanger_ quit (*.net *.split)
09:55:25*lritter quit (*.net *.split)
09:55:25*vsantana quit (*.net *.split)
10:04:14Oddmongeris it possible to build string like we can do with C ternaries ?
10:04:52Oddmonger"%s %s",name,is_here==true?"is here":"is not here"
10:07:05FromDiscord<Rika> Probably the format proc inside strutils
10:07:22FromDiscord<Rika> The one in strformat doesnโ€™t support if else expressions
10:07:23*lritter joined #nim
10:09:09Oddmongeras [ ] supports list comprenhension, isn't it possible to do this with % ?
10:13:39ForumUpdaterBotNew thread by Stefan_Salewski: Initializing objects from proc parameters, see https://forum.nim-lang.org/t/7649
10:21:48FromDiscord<Rika> [] supports list comprehension?
10:23:01OddmongerRika : i've made more searches, but it's seq indeed (and it's tricky with macros), not arrays
10:23:25Oddmongeri guess i stick with strutils
10:23:43FromDiscord<Rika> % is in strutils
10:25:59Oddmongeri was using strformat until now
10:26:32Oddmongerwhat could be the problem with : "Tile: $# \n" % [tile_under_mouse]
10:27:31Oddmongermissing parenthesis maybeโ€ฆ
10:28:46Oddmongerok i had forgotten to convert my type to a string
10:34:44FromGitter<HJarausch_gitlab> Why do I get this error message? Thanks for some hints. โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=6051db44c1e10242c5a4bd37]
10:38:56FromDiscord<Goel> Just to be sure `null` and `nill` have the same meaning (for example a variabile has been assigned a type but not a value)?
10:39:03FromDiscord<Gary M> Nil
10:39:09FromDiscord<Goel> (edit) "`nill`" => "`nil`"
10:39:13FromDiscord<Gary M> Yes
10:41:16FromDiscord<Rika> Value types cannot be nil
10:42:15FromDiscord<Gary M> Might have to due with the fact that the proc you're passing in is creating a closure around another variable, you you might have to make foo accept a closure proc as well?
10:42:25FromDiscord<Gary M> I'm not 100% on that stuff yet.
10:44:07FromDiscord<Goel> Im using binding for GLFW, in GLFW manual it uses NULL because its in C, but on Nim it is used as nil
10:44:16FromDiscord<Goel> (edit) "NULL because" => "`NULL `because" | "nil" => "`nil`"
10:44:17FromDiscord<Rika> They are equal then
10:44:20FromDiscord<Gary M> Yes it's the same
10:45:29FromGitter<haxscramper> @HJarausch_gitlab Change to `let CF : proc(x,y:int): bool = (if not isNil(C): C else: (proc(x,y:int): bool = x < y))`
10:46:10FromGitter<haxscramper> You have `C` as a procvar, wich implies `{.closure.}` and non-side-effect-free (i.e. it can have side effects)
10:46:34FromGitter<haxscramper> But for `if` expression type is determined by first branch
10:46:57FromGitter<haxscramper> IN which you have a non-closure proc (no captures), and it is side-effect-free
10:47:33FromGitter<haxscramper> And in the second branch you tried to narrow the type of `C` to have `{.closure.}` and `{.noSideEffect.}` which is not possible
10:47:51FromGitter<haxscramper> Well, at least it looks like a plausible explanation, though there might be something else going on
10:50:21FromGitter<haxscramper> And you can also use `C: proc(x,y: int): bool = (proc(x,y:int) : bool = x < y)` as a default value for callback, so you don't need to explicitly pass `nil` to trigger default behavior โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=6051deed2beb1e1da3b09aef]
11:07:45FromGitter<HJarausch_gitlab> @haxscramper Thanks! Is there a means to declare a procvar as *non-closure* ?
11:10:20FromDiscord<mratsim> In reply to @HJarausch_gitlab "<@608382355454951435> Thanks! ": {.nimcall.}
11:10:59FromDiscord<mratsim> but if C is captured and not passed as parameters is HAS to be a closure
11:13:45*haxscramper quit (Remote host closed the connection)
11:14:13*haxscramper joined #nim
11:16:53FromGitter<HJarausch_gitlab> @mratsim Thanks! BTW, have you seen my bug report on *Weave* makes *Nim devel* crash?
11:17:13FromDiscord<mratsim> yes
11:17:21FromDiscord<mratsim> It makes my CI crash as well.
11:17:49FromDiscord<mratsim> But not on Linux AFAIK
11:18:47FromGitter<HJarausch_gitlab> I am working on Gentoo Linux (AMD64) where I noticed this crash.
11:19:34FromDiscord<mratsim> interesting
11:19:50FromDiscord<mratsim> ah I forgot to test on latest devel, I'm using an old devel
11:20:30FromDiscord<Yardanico> AFAIK Araq will investigate it
11:20:51FromDiscord<Yardanico> https://github.com/nim-lang/Nim/pull/17311
11:22:32*irdassis joined #nim
11:28:43*PMunch quit (Ping timeout: 265 seconds)
11:32:42*irdassis quit (Quit: Connection closed)
11:37:48ForumUpdaterBotNew thread by Matkuki: Easiest way to pass data between threads?, see https://forum.nim-lang.org/t/7650
11:42:32*tanger_ joined #nim
11:45:25*tanger__ quit (Ping timeout: 276 seconds)
11:47:00FromGitter<HJarausch_gitlab> @mratsim ``but if C is captured and not passed as parameters is HAS to be a closure`` โŽ โŽ But it is not captured here โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=6051ec3388edaa1eb8c0dd59]
11:48:29FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2Tba
11:58:08FromDiscord<mratsim> Interesting post: https://github.com/apple/swift-evolution/blob/main/proposals/0306-actors.md
11:58:22FromDiscord<mratsim> (edit) "post:" => "post, bringing actors to Swift:"
11:58:36FromDiscord<Yardanico> apparently zig will change the function declaration syntax so all functions are anonymous and are assigned like variables https://github.com/ziglang/zig/issues/1717
12:01:48FromDiscord<Yardanico> and not just both, they want to only allow the assignment syntax in the future
12:01:51FromDiscord<hotdog> Anyone know the best way to pass an array[X, typedesc] to a macro? Currently it shows up with len 0
12:02:04FromDiscord<hotdog> I want to iterate over a bunch of types
12:02:17FromDiscord<Yardanico> @hotdog all arguments in a macro are converted to NimNodes unless it's a `static` argument
12:02:20FromDiscord<hotdog> Accepting them as NimNodes doesn't work either as they are typedescs
12:02:31FromDiscord<Yardanico> and dealing with typedescs in a macro isn't that easy, yeah :P
12:07:24FromDiscord<hotdog> Yeah macros are finnicky
12:07:59FromDiscord<hotdog> I guess I'll do something differently here
12:11:10*vsantana joined #nim
12:16:18*lritter quit (Ping timeout: 245 seconds)
12:20:17FromDiscord<Goel> https://picresize.com/images/rsz_screenshot_from_2021-03-17_13-18-08.jpgโ†ตWhat's that?
12:21:07*quantimnot joined #nim
12:21:10FromDiscord<Yardanico> https://en.wikipedia.org/wiki/Incremental_compiler
12:21:20FromDiscord<Yardanico> https://github.com/nim-lang/RFCs/issues/46
12:24:30FromDiscord<Goel> I see, well seems Araq did the right choise on that too
12:24:52FromDiscord<Rika> In reply to @Yardanico "apparently zig will change": whats your opinion on it?
12:27:12*rockcavera joined #nim
12:31:00*tane joined #nim
12:32:59*tanger_ quit (Quit: Leaving)
12:33:17*PMunch joined #nim
12:35:55FromDiscord<Yardanico> no particular opinion, I don't use Zig (I have tried it a bit around 1.3 years ago)
12:36:15narimiranhow did you come to that 0.3 part? :D
12:36:51FromDiscord<clyybber> In reply to @mratsim "Interesting post, bringing actors": thanks
12:37:02narimiran"that was one year, three months and 18 days ago"
12:37:34narimiranomg, you tried it on March 1st 2020?
12:37:42PMunchAround then, might've been 17 or 19 days ago
12:37:47FromDiscord<clyybber> it makes sense since zig doesn't have overloading
12:37:59narimiranPMunch: true....
12:38:01FromDiscord<Rika> it doesnt????? christ
12:38:15FromDiscord<Rika> how would that work?
12:39:40FromDiscord<Yardanico> @narimiran actually it's more like 1.5 years ago
12:39:44FromDiscord<Yardanico> around sept. 2019
12:39:53FromDiscord<Yardanico> http://github.com/Yardanico/zig-osureplay/
12:40:08FromDiscord<Yardanico> https://github.com/Yardanico/zig-libui
12:40:40narimiran*correction: that 'March 1st' guess of mine is obviously incorrect, i apologize
12:41:02FromDiscord<Yardanico> @Rika hidden control flow
12:41:03FromDiscord<Yardanico> zig is against that
12:41:15FromDiscord<Yardanico> overloading operators is "hidden control flow"
12:41:30FromDiscord<Solitude> cringe
12:41:48FromDiscord<Yardanico> https://ziglang.org/learn/overview/#small-simple-language
12:43:36FromDiscord<Yardanico> funny thing is that Nim can be all of those 3 examples at the same time
12:44:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tbt
12:45:00FromDiscord<Rika> i mean if people dont like zig theres nim, and vice versa, so i guess it worls
12:45:02FromDiscord<Rika> works
12:45:08FromDiscord<Yardanico> yes
12:45:32FromDiscord<Yardanico> anyway, back to where I was, understanding why https://github.com/t8m8/currying is broken on nim 1.4+
12:46:46*quantimnot quit (Quit: Connection closed)
13:02:09FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbI
13:02:20FromDiscord<Yardanico> what do you want it ti do?
13:02:21FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2TbI" => "https://play.nim-lang.org/#ix=2TbK"
13:02:24FromDiscord<Yardanico> (edit) "ti" => "to"
13:02:53FromDiscord<Livingstone> this is the python code
13:02:54FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbL
13:03:07FromDiscord<Livingstone> I guess it's supposed to evaluate to no value?
13:03:42FromDiscord<Yardanico> you can't do that in Nim, value types can't be "nil", can you show `algorithm`?
13:03:48FromDiscord<Yardanico> i need to see what does it do with test_set
13:04:14FromDiscord<Yardanico> and also, you're missing `var` and `let`s everywhere, " test_set = seq[float]" is not valid either
13:04:28FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbN
13:04:38FromDiscord<Livingstone> I know don't worry about the var stuff
13:04:41FromDiscord<Yardanico> but you're calling it with two arguments and here ther eare 4 of them?
13:04:45FromDiscord<Yardanico> (edit) "ther eare" => "thereare"
13:04:47FromDiscord<Yardanico> (edit) "thereare" => "there are"
13:05:24FromDiscord<Livingstone> my mistake
13:05:31FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2TbN" => "https://play.nim-lang.org/#ix=2TbO"
13:05:35FromDiscord<Yardanico> also, you're doing `row_copy` wrong, it should be `var row_copy = row`
13:06:19FromDiscord<Livingstone> (edit)
13:06:36FromDiscord<Yardanico> and then my only guess to what "row_copy[-1] = None" does is `discard row_copy.pop()`
13:07:07FromDiscord<Yardanico> maybe it copies row, removes the last value and it copies adds it to a test_set
13:07:12FromDiscord<Yardanico> was that python code written by you?
13:07:22FromDiscord<Yardanico> can you explain what's "row_copy[-1] = None" supposed to do here?
13:08:09FromDiscord<Livingstone> no it's a standard evaluation code block
13:08:19FromDiscord<Yardanico> ???
13:08:56*irdassis joined #nim
13:08:59FromDiscord<Yardanico> so did you copy it from https://machinelearningmastery.com/create-algorithm-test-harness-scratch-python/ ?
13:09:14FromDiscord<Yardanico> then my only guess is to do `row_copy[^1] = 0`
13:09:24FromDiscord<Yardanico> but really try to understand the code you're copying
13:12:17FromDiscord<Livingstone> I didn't take it from here but it's the same code
13:12:32FromDiscord<Livingstone> guess I'll give it a go
13:12:32*irdassis quit (Client Quit)
13:19:55*tane quit (Quit: Leaving)
13:24:37*Vladar joined #nim
13:26:03FromDiscord<zidsal> quick question how come `nimble build --outdir:"bin"` ignores the outdir flag (executable is built in the root) but `nimble c src/foo.nim --outdir:"/bin"` respects the flag? is this a bug or does nimble build not respect all compiler flags?
13:27:21FromDiscord<Yardanico> @zidsal fyi - deleting messages is pretty useless since they're logged anyway
13:27:42FromDiscord<zidsal> ah apologies, I just moved it to the nimble channel as I didn't realise there was one
13:27:54PMunchYeah, better to leave a "oh wait, never mind" or something similar
13:28:43FromDiscord<zidsal> is this where I find out that the nimble channel is not bridged to irc e.t.c
13:28:55FromDiscord<Yardanico> it's bridged to IRC as well
13:29:00FromDiscord<Yardanico> but not logged officially
13:29:01FromDiscord<Rika> there are less people in the nimble channel i believe
13:36:09FromDiscord<hotdog> Anyone got any pointers for what to try when sending data through netcat works, but the same doesn't using Nim's sockets from the net module? The server I'm sending to doesn't give me a lot of feedback..
13:39:13FromDiscord<hotdog> Nevermind, missing a newline....
13:45:01*cyraxjoe quit (Quit: No Ping reply in 180 seconds.)
13:46:10*cyraxjoe joined #nim
13:57:16*Q-Master quit (Ping timeout: 256 seconds)
14:00:42*Vladar quit (Quit: Leaving)
14:05:13*Gustavo6046 joined #nim
14:10:02m4r35n357Hi all, think I've found a mistake in the docs regarding tuples, " . . . The names of the fields also have to be identical." It seems they absolutely do _not_ have to be identical. Have I missed a subtlety here?
14:10:37m4r35n357I found this whilst refactoring, I didn't get the compiler errors that I was expecting.
14:12:29FromDiscord<Rika> can you give an example
14:12:36FromDiscord<Rika> code that does the unexpected thing
14:14:05m4r35n357are you OK to do a temporary clone of a git repo?
14:14:20FromDiscord<Rika> sure
14:14:57m4r35n357OK, clone this: https://github.com/m4r35n357/ODE-Playground, go to blackhole branch
14:15:30FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tc3
14:15:36m4r35n357to build the simulator: ./nim c h_kerr_simulate.nim
14:15:45FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2Tc3" => "https://play.nim-lang.org/#ix=2Tc4"
14:15:50FromDiscord<Yardanico> @Livingstone show the full compiler error please
14:15:57FromDiscord<Yardanico> all lines that the compiler throws at you
14:16:39m4r35n357that should be OK, now edit h_herr.nim, which defines the "global" tuple, and put an underscore in, say, the q_r field. The code still compiles
14:16:47FromDiscord<Rika> it compiles
14:16:48FromDiscord<Rika> ok
14:16:52FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tc5
14:16:58FromDiscord<Rika> underscores are ignored
14:17:06FromDiscord<Rika> nim style insensitivity
14:17:13FromDiscord<Rika> also caps
14:17:27FromDiscord<Rika> caps except the first chaqr
14:17:28FromDiscord<Rika> (edit) "chaqr" => "char"
14:17:28m4r35n357aaargh! at least it is known . . .
14:17:42FromDiscord<Rika> this applies for everything, including stuff like `proc` and `int` etc
14:18:02m4r35n357Rika I think I knew about it for numbers, but not anything else!
14:18:42FromDiscord<Yardanico> @Livingstone what type is `fold`?
14:18:45m4r35n357is that not a bit over-generous in terms of typ safety?
14:19:02*Gustavo6046 quit (Ping timeout: 260 seconds)
14:19:14FromDiscord<Yardanico> no, it's not related to type safety at all
14:19:35FromDiscord<Livingstone> In reply to @Yardanico "<@!263060627793248278> what type is": fold is a seq[float]
14:19:47FromDiscord<Yardanico> @Livingstone then `row` is a float, and you're trying to use it as seq[float]
14:20:01FromDiscord<Rika> "acc" is still != to "acs" so
14:20:14FromDiscord<Livingstone> I know row is a float but am I not adding it to a sequence?
14:20:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tc7
14:20:34FromDiscord<Yardanico> row[^1] means "get the last element from the container"
14:20:44FromDiscord<Yardanico> but you can't get the last element from the float as it's a single value already
14:20:45FromDiscord<Rika> maresnest: its to allow for snakecase code to interface with camelcase code
14:20:53FromDiscord<Livingstone> ok
14:21:20*Gustavo6046 joined #nim
14:21:38FromDiscord<Yardanico> @m4r35n357 the rule is basically something like this - identifiers have partial case insensitivity - all characters except the first one are compared ignoring the case, and underscores are ignored
14:21:49FromDiscord<Yardanico> See https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
14:21:58m4r35n357Rika, hmm, well if you say so, but I still think the docs are misleading, for usual meaning of the word "identical"
14:22:21FromDiscord<Livingstone> sweet jesus it finally compiled
14:23:35FromDiscord<Rika> thats a reasonable statement
14:23:47FromDiscord<Rika> <--failing to speak english for some reason
14:23:55FromDiscord<Rika> please pay no mind to the awkward english
14:25:18m4r35n357Rika if you are concerned about a missing apostrophe you are more strict than the compiler ;)
14:26:05FromDiscord<Rika> no, im worried about how "reasonable statement" sounds kinda awkward
14:26:24m4r35n357nope
14:26:29FromDiscord<Rika> and the compiler minds its apostrophes, just not its underscores
14:26:54m4r35n357your statement was perfectly reasonable!
14:27:06FromDiscord<Rika> lmao
14:27:21FromDiscord<Rika> anyway if you dont mind it its prolly best if you PR the correction
14:29:00FromDiscord<mario2> Can I enforce rules to how variables are typed? I'm reading the source code to a package called perlish and I was just curious if it was possible to enforce usage of $var in code.
14:30:00*Q-Master joined #nim
14:31:48m4r35n357well that serves me right for pointing it out . . . OK here: https://github.com/nim-lang/Nim/issues/17403
14:32:13FromDiscord<Rika> hey, you dont HAVE to do it, i did say "if you dont mind"
14:33:43m4r35n357perhaps I don't mind, I think it is the right thing to do, you can always close it ;)
14:34:48FromDiscord<Rika> am i finally going insane or is this english hard to understand
14:35:00FromDiscord<Yardanico> ?
14:35:16FromDiscord<Rika> i think im going insane then
14:35:30FromDiscord<mario2> If it makes you feel better, it's more fun to be insane.
14:36:59*vsantana quit (Quit: leaving)
14:52:23FromDiscord<mario2> I can use a template to make an alias for var right? Like have `integer foo = 10` and nim will know I'm actually saying `var foo:int = 10`
14:55:18FromDiscord<Goel> This function sets the position, in screen coordinates, of the upper-left corner of the content area of the specified windowed mode windowโ†ต`Do not use this function` to move an already visible window unless you have very good reasons for doing so, as it will confuse and `annoy the user.` Hahaha
15:02:08*vicfred joined #nim
15:02:18*superbia joined #nim
15:06:05FromDiscord<mario2> sent a code paste, see https://play.nim-lang.org/#ix=2Tcx
15:08:35FromDiscord<Yardanico> templates are not simple text like aliases, they're code substitution
15:08:50FromDiscord<Yardanico> I already did a integer implementation for you some days ago, no?
15:09:23FromDiscord<mario2> You did? I think forgot about that one.
15:10:46FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tcz
15:10:47FromDiscord<Yardanico> but just "integer foo" won't work
15:11:08FromDiscord<mario2> Why not?
15:11:20FromDiscord<Yardanico> because "integer foo = 10" is parsed like integer(foo) = 10"
15:11:23*superbia quit (Quit: WeeChat 3.1)
15:11:27FromDiscord<Yardanico> so we just create a new var and return it so it can be assigned to
15:11:41FromDiscord<Yardanico> but without it we just have `integer(foo)` and `name` is not assigned to
15:12:41FromDiscord<mario2> Would making just plain old INTEGER X be possible?
15:13:00FromDiscord<haxscramper> remove trailing `name` in template and you would just declare type
15:13:10FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TcA
15:13:17FromDiscord<haxscramper> But you can't write template that supports both `int a` and `int a =12` at once
15:13:18FromDiscord<Yardanico> directly in `integer bar`
15:13:20FromDiscord<Yardanico> exactly
15:14:15FromDiscord<haxscramper> !eval import std/macros; dumpLisp(int a)
15:14:17NimBot<no output>
15:14:22*superbia joined #nim
15:14:37FromDiscord<mario2> For what reason would I need to declare a variable without assigning it a value?
15:14:39PMunchIt doesn't show compile-time outputs
15:14:53FromDiscord<Yardanico> @mario2 ?????????? you asked that yourself
15:15:01FromDiscord<Yardanico> > Would making just plain old INTEGER X be possible?
15:15:15FromDiscord<mario2> I did ask. But now i'm questioning it.
15:15:56FromDiscord<Yardanico> and no it won't even work with a macro (unless you wrap the whole block of code in a macro call)
15:16:32FromDiscord<mario2> I guess I'll make a rule that all unassigned ints must be assigned to 0 if just declaring it. Problem solved.
15:16:44FromDiscord<Yardanico> lol
15:17:06FromDiscord<mario2> What's lol about it? If it's 0 it wouldn't do anything with it.
15:17:33FromDiscord<Yardanico> also, you might want to take some inspiration for some kind of `cobolish` macro from https://github.com/Yardanico/nimpylib/blob/master/src/pylib/tonim.nim and https://github.com/Yardanico/nimpylib/blob/master/src/pylib/class.nim
15:18:07FromDiscord<mario2> Funny you should mention `cobolish` because I plan on having a COBOL like syntax.
15:18:20FromDiscord<Yardanico> you said that before, yes
15:19:24FromDiscord<mario2> Can I assign a variable to NULL?
15:19:37FromDiscord<Yardanico> only reference/pointer types
15:19:40FromDiscord<Yardanico> value types can't be null
15:22:12FromDiscord<Rika> you can simulate null with Option[T]
15:24:17FromDiscord<mario2> Well it gives me a redefinition error if I try to use both declare template and integer template. Oh well.
15:25:37FromDiscord<haxscramper> I doubt you will be able to introduce enough templates to make cobol-like syntax in nim
15:25:44FromDiscord<haxscramper> You need to use macros
15:26:38FromDiscord<Yardanico> yep
15:28:10FromDiscord<Yardanico> @mario2 just for a simple example:
15:28:16FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TcJ
15:28:27Prestige@mario2 https://dev.to/beef331/demystification-of-macros-in-nim-13n8 may be of use to read
15:28:31FromDiscord<haxscramper> So you could rewrite `Asgn[Command[@typename, @varname], @expr]` to `VarSection[IdentDefs[varname, typename, expr]`
15:28:42FromDiscord<mario2> Thanks a million. I'll save this example for later.
15:28:53FromDiscord<Yardanico> it's all basic ast manipulation, nothing fancy
15:29:00FromDiscord<Yardanico> `treeRepr` is your friend
15:29:01FromDiscord<haxscramper> And since you most likely will have some kind of IR for your cobol you can also read https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html
15:29:03FromDiscord<Yardanico> (from macros)
15:33:30FromDiscord<mario2> Last question. Would I be able to use a macro or template to enforce rules on how the code is organized? Like have variables with dollar signs in them like it's a shell script? $A or $FOO or $BAR for example? Just curious.
15:34:06FromDiscord<Yardanico> of course
15:34:20FromDiscord<Yardanico> as long as it's valid nim _syntax_, you can do whatever you want in macros
15:34:43FromDiscord<Yardanico> and nim syntax is pretty flexible
15:35:05*superbia quit (Quit: WeeChat 3.1)
15:38:17*gpanders joined #nim
15:39:13*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
15:40:24*literal joined #nim
15:48:54*xet7 quit (Quit: Leaving)
16:05:23FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Td4
16:05:39FromDiscord<Livingstone> for the return statement
16:07:11FromDiscord<Rika> not returning a tuple, cannot return two values
16:07:23FromDiscord<Rika> also () needed if you were returning a tuple, i believe
16:09:09*rockcavera quit (Read error: Connection reset by peer)
16:09:35*rockcavera joined #nim
16:10:25FromDiscord<Goel> `setTime(time: cdouble)` What's cdouble in Nim? I only find `cint` or `cbool` or `cchar` online
16:13:47FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2Td7
16:13:51FromDiscord<InventorMatt> that should solve your problem
16:14:27FromDiscord<Kiloneie> Whats a good source control ? program ? Just need something to show me the differences between 2 files of code
16:15:07FromDiscord<Kiloneie> so i don't accidentally have something weird when recording a next video on a subject that uses the same code but with extras
16:15:55FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Td8
16:16:12FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2Td8" => "https://play.nim-lang.org/#ix=2Td9"
16:16:42FromDiscord<InventorMatt> you would need to do (b0, b1) = coefficients(train) then
16:17:17FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tda
16:17:18FromDiscord<InventorMatt> yes
16:17:43FromDiscord<InventorMatt> as long as you intialize b0 and b1 as vars first
16:19:29leorize[m]@Kiloneie git is the most popular SCM
16:19:43FromDiscord<Kiloneie> you can lock it down right ?
16:20:01FromDiscord<Kiloneie> im seeing some extension for vs code...
16:20:23FromDiscord<haxscramper> You can make a repo with your video series and just associate particular video with a commit
16:21:04FromDiscord<haxscramper> (edit) "video series" => "code for your videos/"
16:21:56FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tdd
16:23:07FromDiscord<InventorMatt> what does a row in the csv file look like?
16:23:24FromDiscord<Livingstone> [1.23 , 11]
16:23:34*fredrikhr quit (Quit: Client Disconnecting)
16:24:29*Gustavo6046 joined #nim
16:25:57FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tdg
16:29:31FromDiscord<InventorMatt> that may work
16:29:32FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2Tdj
16:33:16FromDiscord<Livingstone> yes it works thanks
16:36:45*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
16:37:30*Gustavo6046 joined #nim
16:42:55*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
16:43:27*Gustavo6046 joined #nim
16:49:53FromDiscord<Livingstone> So this is the final program but when I echo rmse all I get back is 0.0
16:49:56FromDiscord<Livingstone> https://play.nim-lang.org/#ix=2Tdv
16:50:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tdw
16:50:30FromDiscord<Yardanico> In reply to @Livingstone "So this is the": Because you don't call your procedures at all?
16:51:11FromDiscord<Yardanico> On line 6 you define rmse and then try to echo it at the bottom and it prints 0.0 because that's the default value for a float
16:51:30FromDiscord<Yardanico> You're not actually calling any of your procedures
16:51:42FromDiscord<Livingstone> woops hold on
16:52:32FromDiscord<Yardanico> Also on line 74 "proc" type wouldn't work as you expect it to
16:52:52FromDiscord<Livingstone> yeah I'm working on that now
17:07:47giaco__is it possible to enforce me to handle exceptions?
17:10:38FromDiscord<Ayy Lmao> I'm a noob at networking and I'm trying to do something that interfaces with something that uses ENet. Can I use https://nim-lang.org/docs/net.html for this or do I need to use ENet directly?
17:11:50giaco__or is there a shortcut to do "let myvar = unparseablestring.parseInt.ifExceptionDefaultTo(0)"
17:20:37m4r35n357OK, I am returning to a problem that I had early on when I split stuff up into files and needed generics in a library function to let me "call back" into client code. There was an unintended consequence to this that made a function that I definitely did _not_ want to export became visible in the library function!
17:21:31m4r35n357I have just checked, and it is still happening if I repeat the mistake that exposed it in the first place
17:22:40m4r35n357It was something to do with "generic binding" and mixins, so I looked up the manual and couldn't find anything that looked like it explained the issue.
17:24:42m4r35n357It is obviously more complicated than I can explain, but easy to trigger from a temporary git checkout
17:27:54FromDiscord<no name fits> So what's the recommended way to handle something when you're using a "bindings" lib (for lack of better term) that's missing some bindings? Obviously create them yourself, but how and where is usually recommended? And I'm assuming it should be done in a way that it's easy to remove when/if it gets added to the lib you're using?
17:30:36FromDiscord<Solitude> In reply to @no name fits "So what's the recommended": fork the bindings, point to your fork as dependency, submit a pr
17:31:13FromDiscord<Solitude> when pr gets merged, point back at main repo
17:31:14FromDiscord<no name fits> I guess I'll have to practice that. I don't have a ton of experience forking
17:31:31FromDiscord<no name fits> Thanks for the input
17:32:17FromDiscord<clyybber> @no name fits depends on the bindings, some are autogenerated
17:35:12liblq-devgiaco__: for your first question, there's `{.raises: [].}` and you can enforce it across an entire module using `{.push raises: [].}` at the top of the module and then `{.pop.}` at the end
17:35:21liblq-devas for the second question though, not that i know of
17:35:31liblq-devthough it's quite easy to create a template for that
17:35:37FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2TdM
17:35:59FromDiscord<clyybber> In reply to @no name fits "Well to be specific,": oh yeah nimgl vulkan is a bit incomplete
17:36:18FromDiscord<clyybber> but its autogenerated
17:38:12FromDiscord<no name fits> oh
17:38:25FromDiscord<clyybber> I also have vulkan bindings which I just updated yesterday (now based off nimgl/vulkans generator)
17:38:37liblq-devgiaco__: https://play.nim-lang.org/#ix=2TdQ
17:38:54FromDiscord<no name fits> In reply to @Clyybber "I also have vulkan": So what's the approach for that?
17:38:55ForumUpdaterBotNew thread by R3c: Memory increase on simple http server after 50 requests, see https://forum.nim-lang.org/t/7653
17:39:21FromDiscord<Solitude> In reply to @no name fits "So what's the approach": switch to clyybbers bindings
17:39:53FromDiscord<clyybber> I'll upload the generator script once I cleaned it up a bit
17:40:50FromDiscord<no name fits> In reply to @Solitude "switch to clyybbers bindings": I'm trying to turn this into an opportunity to learn how to do it myself, in case it happens in the future, and I'm missing some bindings I need ๐Ÿ™‚
17:41:05FromDiscord<Solitude> In reply to @no name fits "I'm trying to turn": in this case you would have to fix the generator
17:41:27FromDiscord<no name fits> So fork the generator?
17:41:30FromDiscord<clyybber> In reply to @no name fits "So what's the approach": its in nimgl/vulkan/tools
17:42:45FromDiscord<clyybber> but if you are doing this to learn about building wrappers in general, keep in min that vulkan is somewhat special with its vk.xml registry file
17:43:19FromDiscord<clyybber> usually you'd go the c2nim route, which I did before for my wrapper
17:43:39FromDiscord<clyybber> but that became a bit of a hacky shellscript
17:45:16FromDiscord<no name fits> So I didn't understand all of that, but as I understand, a generator wraps an xml file that has the bindings?
17:45:51m4r35n357liblq-dev, dunno if you remember talking to me about the issue a few lines up, but I'd appreciate it if you could help me understand what is going on, I think I am in a better position to act on it now than then.
17:46:13FromDiscord<Solitude> vk.xml has protocol description, generator takes that and outputs bindings
17:47:30FromDiscord<clyybber> In reply to @Solitude "switch to clyybbers bindings": oh btw I think you asked for dynlib or platform header support once right? vulkanim has both now you just pass -d:vkDynlib
17:47:59liblq-devm4r35n357: it's kinda hard to tell what you mean just from your description alone, it would be nice if you could attach a code sample
17:48:44FromDiscord<Solitude> yeah, i noticed. but my autism tells me that i have to do my own bindings. i would like to go enums route instead of consts.
17:49:03giaco__liblq-dev: thanks a lot! I got how "otherwise" works, but I'm not getting "raises: []", need some time to read the docs! Thanks a lot
17:49:46FromDiscord<clyybber> In reply to @Solitude "yeah, i noticed. but": ah I have an option for that in the generator
17:49:52liblq-devgiaco__: `raises: []` is an annotation you can attach to procs that signifies that they must only raise exceptions from the provided list `[]`
17:50:08liblq-devin our case the list is empty, so they must not raise any exceptions in order for the code to compile
17:50:20m4r35n357liblq-dev, it is not a simple thing to reproduce without all the code, can you work with a git clone?
17:53:37liblq-devyeah
17:54:11giaco__liblq-dev: ok, but my question was quite different. I'd like something like java, where you declare which exceptions a function raises, and any code that runs it requires to handle that exception. Here it seems the opposite, why should I declare which exceptions my code must don't raise?
17:55:08liblq-devgiaco__: i'd ask @Araq about that tbh
17:55:09m4r35n357liblq-dev, https://github.com/m4r35n357/ODE-Playground check out branch weirdness
17:55:19liblq-devthere's most likely some design rationale behind it
17:55:40liblq-devand it's probably that listing each and every exception while simultaneously having to handle it is annoying
17:56:00liblq-devlisting which exceptions you don't want to handle is less annoying though
17:56:21m4r35n357liblq-dev, nim c h_newton.nim, then: ./h_newton 6 4 1 10000 1 12 .6 | gnuplot -p -e "set terminal wxt size 600,450; splot '<cat' with lines"
17:56:26giaco__I'm quite sure I'm missing the point there, because I quite feel I'm not the nim savvy here. I need to play arout the concept
17:56:51m4r35n357if you don't have gnuplot you can watch the numbers fly by, but they are doing the right thing
17:57:46m4r35n357liblq-dev, so, I contend that, to the uninitiated at least, that code should not even compile.
17:58:46m4r35n357liblq-dev, that branch should be easily diff-able to blackhole, the correct code
18:00:55m4r35n357liblq-dev, ahem, now pushed!
18:01:51liblq-devalright give me a moment
18:02:04m4r35n357liblq-dev, so, weirdness=bad, blackhole=good, but they both work
18:02:06liblq-devexcuse my slow responses, i'm kinda trying to do a million things at once
18:02:35m4r35n357liblq-dev, s'OK, I forgot to push until just now ;)
18:03:02m4r35n357it is just the movement of a single line from one file to another
18:03:31liblq-devalright, so i compiled h_newton
18:03:38liblq-devwhat exactly are you confused about?
18:04:54*superbia joined #nim
18:05:23m4r35n357liblq-dev, OK, ono hte "bad" code, the inserted line 38 in the module symplectic.nim should not run IMO, because it calls a function h() in the calling code that it shouldn't be able to see at all
18:06:03m4r35n357but somehow h() becomes in scope because of the generic parameter
18:06:17m4r35n357and I don't understand how, or why this is a good thing
18:06:25liblq-devit's a quirk
18:06:43m4r35n357but is there any way to avoid it?
18:06:49liblq-devi think h is bould lately when your generic proc is instantiated
18:06:54liblq-devwhich h are you trying to call?
18:07:06liblq-dev(point me to the file)
18:07:15m4r35n357the h is in h_newton.nim, the clling code
18:07:35m4r35n357if you diff weirdness and blackhole it should stick out
18:07:59liblq-devyeah i see it
18:08:38m4r35n357the whole line belongs in h_newton.nim, but I missed it during the refactor, and because the code kept running I didn't spot it until later
18:08:49liblq-devwell it's basically a quirk in how generics work
18:09:16liblq-devwhen you call solve in h_newton.nim the instantiated procedure doesn't exist yet so it goes on to create it
18:09:37liblq-devbut it appears that it creates the new procedure as if it's declared in h_newton.nim instead of symplectic.nim
18:10:12liblq-devif you want to use h from a different module, you can import it in symplectic.nim and add `bind h` to the top of solve()
18:10:52liblq-devthis will "bind" the symbol from the scope where solve was declared
18:11:03m4r35n357liblq-dev, the point is that this is extremely undesirable, I don't want to use h, it is private
18:11:20liblq-devwell, you can pass it as a parameter to solve
18:12:01m4r35n357liblq-dev, but I don't want to
18:12:15liblq-devwellโ€ฆ then how would you like to structure your program?
18:12:36m4r35n357like in blackhole, it is finished
18:13:05m4r35n357I want to do the parameter passing in such a way that I don't leak h() into library code
18:13:13m4r35n357even if I make a mistake ;)
18:13:37liblq-devwell imo passing it as a parameter to solve seems like the sensible option here
18:14:01m4r35n357it shouldn't be there, I don't want to pass it in!
18:14:23m4r35n357it hsould be called from itself like in blackhole
18:15:21liblq-devwell alright, then what's the assignment to p.h0 for?
18:15:27liblq-devon weirdness
18:15:27m4r35n357think I am going round in circles now . . . I a concerned that owing to a "quirk" of generics, private calling code data can leak into library code whereit has no business to be
18:16:10m4r35n357weirdness is the incorrect code, showing how I made the error that exposed the preblem
18:16:28liblq-devit can only leak if you use inexistent procs in your generic proc
18:16:29m4r35n357I had to create it just for this!
18:16:33liblq-devbut i agree it's quite jank
18:16:52liblq-devmaybe open an issue about this?
18:16:55m4r35n357liblq-dev, tghat last thing you said is the bit I am trying to understand
18:17:24m4r35n357I need to understand the problem enough to raise an issue, and that is what I am trying to do now
18:18:08m4r35n357I still don't really get why this is a desirable effect, what is the use case for it?
18:18:18liblq-devm4r35n357 so the thing is that when you write your generic proc and are sure that all procs you call in it are available in the module where you declare the proc, there's no possibility of leaking
18:18:33liblq-devwell there are some use cases
18:18:42liblq-devbut those use cases should require `mixin` imo
18:19:07liblq-devone of these use cases is if you want to eg. call `$` on a value whose type is generic
18:19:15liblq-devthe compiler cannot resolve `$` immediately
18:19:15m4r35n357ah now you mentioned that last time, but I read up on mixins and didn't really get them ;)
18:19:39liblq-devit has to look up `$` from the callsite (the place where the generic proc was called)
18:20:23*oz quit (Remote host closed the connection)
18:21:21m4r35n357liblq-dev, as I said, I dont think I understand the mechanisms enough to make an issue for this, I was hoping to put that right, but it still eludes me. It still looks like a plain leakage of encapsulation issue.
18:22:18liblq-devthe thing is, it is a bad design
18:22:19liblq-devi agree with you
18:22:27liblq-devit's kind of hard to explain to a beginner though
18:22:34liblq-devbecause of how quirky nim generics are overall
18:22:54m4r35n357liblq-dev, but I am struggling to find the right words to put in an issue
18:24:09m4r35n357liblq-dev, I have had great success with generics in other areas, so I hope they are not broken
18:24:34liblq-devi mean they work
18:24:53liblq-devit's just that the language design part is a bit half-baked
18:26:14m4r35n357liblq-dev, can you think of another technique to allow me to "inject" callbacks and parameters into the library? In c it was void pointers, but when I got here I was pointed straight at generics, so went with that
18:26:53liblq-devnot one that's stable
18:27:13liblq-devyou can try concepts but here be dragons https://nim-lang.org/docs/manual_experimental.html#concepts
18:27:37liblq-devand araq is working on a concept overhaul so existing code may break soon
18:28:45liblq-devand there's like a million reasons not to use concepts, such as concept duplication https://github.com/nim-lang/Nim/issues/13982
18:28:59liblq-devthis slows down compilation. a lot.
18:30:54*oz joined #nim
18:31:22m4r35n357liblq-dev, hmm, I think i see the gist of it, but it looks more complicated than what I need. I'll take your warning. I think what I really want is generics that work how I think they should!
18:31:51liblq-devi mean as i said, you can pass your h proc as a parameter to the solve proc
18:32:02liblq-devand i feel like that would be the cleanest possible solution
18:32:09liblq-devwith current mechanisms
18:32:24m4r35n357liblq-dev, let's not go there again, I don't _want_ to do that!
18:32:48m4r35n357I want it _not_ to be passed as anything
18:33:03liblq-devthen you can at least document that you're mixing in procs from outer scopes by adding `mixin h` to the top of solve
18:33:51m4r35n357liblq-dev, how many ways can I say that I don't want ti to be visible, injected, passsed or anything else?
18:34:27liblq-devnone that i know of :/
18:35:09FromDiscord<Solitude> doesnt `bind h` should solve this?
18:35:21FromDiscord<Solitude> i didnt read any of the previous discussion
18:35:43liblq-devit won't
18:35:53m4r35n357Solitude you are describing another way to leak h. I do not want to leak h. I want to stop h leaking
18:35:55liblq-devbecause if h isn't declared where solve() is then it'll error
18:36:12m4r35n357I WANT to see an error!!!!!!!
18:36:52liblq-devyou will, but it will always error!!
18:37:00liblq-devno matter if your code is valid or not!
18:37:24m4r35n357liblq-dev, thanks, I am work out now!
18:37:31m4r35n357worn out . .
18:38:02liblq-devsorry that nim's generic system is so underbaked
18:38:27liblq-devhopefully once new concepts get rolled out the situation improves, but for now, we can only hopeโ€ฆ
18:38:39m4r35n357liblq-dev, come on, I am trying to understand, not criticise
18:39:17liblq-devi mean i'm the critic here aight
18:39:32liblq-devi'm trying my best to explain
18:39:33m4r35n357I just got everything working and returned to the one thing that I didn't feell comfortabe with to see if had learned anything
18:39:57liblq-devand i'm sorry to say that but unfortunately i don't really see a solution to your problem
18:40:03m4r35n357and you ahve been very helpful
18:42:19m4r35n357liblq-dev, so I think I'll just have to ignore it for now. Cheers anyway!
18:42:35liblq-devcheers!
18:44:12FromDiscord<clyybber> huh? that's not a quirk
18:44:17FromDiscord<clyybber> that's an intentional design
18:44:34FromDiscord<clyybber> and it makes perfect sense, after all you are calling solve from h_newton.nim ?
18:44:39FromDiscord<clyybber> where h is in scope
18:45:45m4r35n357clybber, yes, but that is none of solve()s business
18:46:08FromDiscord<clyybber> it is, because generic procs should be able to use locally defined overloads
18:46:16FromDiscord<clyybber> think about this:
18:46:36FromDiscord<clyybber> you define a hash for your type
18:46:40FromDiscord<clyybber> and want to use the table module
18:46:46m4r35n357clybber now that what I am trying to understand,
18:46:47FromDiscord<clyybber> you shouldn't be required to export your hash for that
18:47:50m4r35n357OK not a user of the table module or hashes but I think I can follow . .
18:48:19FromDiscord<clyybber> m4r35n357: If you want the generic to only take a definition from it's declaration scope you want to `bind h`
18:48:35FromDiscord<clyybber> this should prevent your example from compiling
18:49:34m4r35n357clybber that sounds like something I can try - I don't actually know what 'bind h' does but now I can look it up
18:49:56FromDiscord<clyybber> bind h will bind `h` during the declaration of the generic
18:49:59FromDiscord<fwsgonzo> looks like the RISC-V 32-bit platform was merged with 1.4.4, that's very handy - now I don't have to build my projects from Nim source
18:50:06FromDiscord<clyybber> \o/
18:50:08FromDiscord<fwsgonzo> there was nothing in the changelog
18:50:12m4r35n357as long it isn't another way of making h visible to solve . .
18:50:34liblq-dev@clyybber that's just my 2 cents but even though the design is intentional i don't think it's particularly good
18:50:46FromDiscord<clyybber> it's the only thing that makes sense
18:51:05FromDiscord<clyybber> liblq-dev: I mean, how else would you do it?
18:51:19liblq-devrust can get away without this "only thing that makes sense" by having a functioning trait system ๐Ÿ™ƒ
18:51:22m4r35n357clybber so I 'bind h' somewhere in h_newton.nim, and it stops h being visible in solve() ????
18:51:32FromDiscord<clyybber> You could of course switch it around and say symbols should be bound at declaration by default and explicitly mixed in
18:51:51liblq-devi can already hear you typing because i mentioned rust
18:52:03FromDiscord<clyybber> me?
18:52:09liblq-devsomebody
18:52:11m4r35n357clybber where precisely would you put the 'bind h' ?
18:52:24FromDiscord<clyybber> m4r35n357: at the start of the proc body
18:52:33m4r35n357whcih proc, h?
18:52:53FromDiscord<clyybber> no solve
18:53:10m4r35n357how can I tell solve not to look at sometinig it can't see?
18:53:24liblq-devthe thing that's good about rust's trait bound system is that it's much more explicit than nim's rather lenient generics. you declare which traits a generic must satisfy, and if you use a function outside of those traits you get an error
18:53:27m4r35n357h is not in scope
18:53:28FromDiscord<clyybber> by binding the symbols you use
18:53:36liblq-devthis can be solved by the new concepts
18:53:42FromDiscord<clyybber> m4r35n357: You are caling h
18:53:46FromDiscord<clyybber> (edit) "caling" => "calling"
18:53:52m4r35n357not from solve()
18:53:58FromDiscord<clyybber> you are
18:54:07m4r35n357no, that is the incorrect code,
18:54:23FromDiscord<clyybber> there is no way to prevent this "incorrect code"
18:54:37FromDiscord<clyybber> other than making your function not generic
18:54:51m4r35n357clybber that is waht liblq-dev said, and we left ti there
18:55:21FromDiscord<clyybber> hmm, so you want it for additional error checking?
18:55:22*Vladar joined #nim
18:55:28m4r35n357I can just pretend I never made the mistake, and never saw the problem.
18:56:12FromDiscord<clyybber> liblq-dev: I don't think the new concepts address that
18:57:49FromDiscord<TurtleP> sent a code paste, see https://paste.rs/q46
18:58:20*waleee-cl joined #nim
18:59:11m4r35n357OK guys thanks, I think we have established now that there is nothing to be done about this, and I will be satisfied with my working code ;)
19:00:47FromDiscord<clyybber> @TurtleP Object construction uses Object(fieldName: value) syntax in nim :)
19:01:00FromDiscord<clyybber> also hey, are you the turtlep from the love2d 3ds port?
19:01:10FromDiscord<TurtleP> maaaaybe ๐Ÿ‘€
19:01:14FromDiscord<clyybber> haha awesome
19:01:36FromDiscord<TurtleP> @clyybber but even besides that point, it seems to not like `get_icon()`
19:02:11FromDiscord<TurtleP> `attempting to call undeclared routine: 'get_icon'`
19:02:52FromDiscord<TurtleP> it seems to be acting as though the HAC "class" isn't inheriting anything from Console
19:03:37FromDiscord<clyybber> hmm, if I correct the object construction and export the fields it compiles fine for me
19:03:56FromDiscord<TurtleP> export the fields?
19:04:10FromDiscord<clyybber> yeah, you have to add an asterisk after their name
19:04:20FromDiscord<clyybber> in the type definition of Console
19:04:30FromDiscord<TurtleP> I thought it would make it purely public which would be weird
19:04:48FromDiscord<clyybber> oh yeah it would, I figured you want that since you are constructing HAC in your main.nim
19:04:54FromDiscord<TurtleP> almost like being able to do `ConsoleObject.app_name = "blah"`
19:05:10FromDiscord<TurtleP> (but then again nobody is creating a new Console object)
19:05:14FromDiscord<clyybber> So from what I gather you probably want to define a constructor for HAC
19:05:29FromDiscord<TurtleP> Console has some common things I need, though which is why I have it
19:05:40FromDiscord<clyybber> in nim constructors are nothing special so just call it newHAC
19:06:07FromDiscord<clyybber> @TurtleP you are not importing console in your main are you?
19:06:11FromDiscord<TurtleP> no
19:06:25FromDiscord<clyybber> you have to do that to have get_icon be available in main.nim
19:06:34FromDiscord<clyybber> or alternatively you can export console from hac.nim
19:07:34FromDiscord<TurtleP> I assume the latter is better practice?
19:07:54FromDiscord<clyybber> I guess so? I would do the latte
19:07:55FromDiscord<clyybber> (edit) "latte" => "latter"
19:08:10FromDiscord<TurtleP> how would I go about this?
19:08:22FromDiscord<clyybber> just `export console` after your `import console`
19:09:57FromDiscord<clyybber> liblq-dev: The trait way wouldn't be nimmy IMO, since usually procs aren't bound to a single type.
19:10:46FromDiscord<clyybber> liblq-dev: IMO a good solution for nim would be a `bindall` statement or something similar
19:11:20FromDiscord<Goel> What is the problem with "circular imports"in Nim? I read that about often in forums, but i don't understand why that is an issue in Nim. Is this something only Nim language have a problem with, or is a common problems?
19:11:35FromDiscord<Goel> (edit) "problems?" => "problem?"
19:11:53FromDiscord<clyybber> @Goel Basically you can't have mutual recursion accross objects
19:11:57FromDiscord<clyybber> (edit) "objects" => "modules"
19:12:21FromDiscord<clyybber> unless you include them
19:12:51FromDiscord<zidsal> java has the same issue, maven very much frowns upon circular dependencies
19:12:52FromDiscord<Goel> Which is a way to fix this? I mean just having a better organization and/or rename some modules will fix this issue?
19:13:05FromDiscord<zidsal> move the shared logic out to a 3rd module
19:13:31FromDiscord<clyybber> it's never an issue for me, but other people resort to using include or a seperate module
19:13:40FromDiscord<TurtleP> @clyybber thanks for the tips! kinda odd having to export console after importing, though
19:13:44Clonkk[m]<FromDiscord "<clyybber> @Goel Basically you c"> You can partially
19:14:12FromDiscord<clyybber> with include and forward decls
19:14:20FromDiscord<clyybber> I can't think of any other way, no?
19:14:30FromDiscord<TurtleP> that's fair dw
19:15:13FromDiscord<clyybber> @TurtleP Oh, haha I was replying to Clonkk; I guess it's a bit odd if you are coming from an OOP language
19:15:40Clonkk[m]<FromDiscord "<clyybber> I can't think of any "> Sort of. I don't have the code right now to show you (i'm on a phone) but I think @timothethecour mentionned it in the github issue
19:17:29FromDiscord<Goel> I found this, even though they was commenting on the same problem but on Python:โ†ต`"In general, circular imports are the result of bad designs. A deeper analysis of the program could have concluded that the dependency isn't actually required, or that the depended functionality can be moved to different modules that wouldn't contain the circular reference. A simple solution is that sometimes both modules can just be merged into a single, lar
19:18:32FromDiscord<no name fits> What I was taught, was that circular imports are usually a sign, that it should be in the same module
19:19:08FromDiscord<zidsal> what are the actual modules, if you give us a concrete example we can help you ๐Ÿ˜›
19:19:24FromDiscord<clyybber> @zidsal I think it was just a question out of curiosity
19:19:29FromDiscord<zidsal> ah
19:20:00FromDiscord<zidsal> pretty sure most major languages that I can think of don't like circular imports
19:20:09FromDiscord<Goel> Yes, i haven't faced that issues fortunatly, probably that something to worry about with bigger projects
19:20:25FromDiscord<Goel> (edit) "issues fortunatly," => "issuesfortunatly,"
19:20:32FromDiscord<Goel> (edit) "issuesfortunatly," => "issue fortunatly,"
19:20:52FromDiscord<clyybber> hmm, IME it's not an issue, but different people different structures I suppose
19:21:01FromDiscord<clyybber> (edit) "IME" => "for me"
19:25:53FromDiscord<exelotl> I encounter it a lot, as I tend to structure my game with 1 module per entity or subsystem, and they need to talk to each other, but I can't afford to use e.g. an event system / observer pattern because I'm targetting limited hardware
19:26:26FromDiscord<exelotl> I've never experienced the same problem in C, Java, C# or AS3
19:27:45FromDiscord<zidsal> if you treated nim modules like java modules instead of packages you would run into the exact same issue in java
19:29:52liblq-dev@clyybber but oh the new concepts solve this completely
19:30:03liblq-devprocs still aren't bound to a single type
19:30:30liblq-devconcepts just make generic type matching verifiable on a more fundamental level
19:30:41liblq-devand allow for better, earlier error handling
19:30:50liblq-devwith nicer error messages
19:31:38liblq-devthat's all i'm going for here
19:31:58liblq-devconcepts shouldn't only serve as a source for documentation, they should also be a hint to the compiler
19:32:54FromDiscord<exelotl> I don't have a JDK set up currently but I'm pretty sure you can do: `A::foo()` calls `B::foo()`, and `B::bar()` calls `A:bar()` in Java
19:33:14FromDiscord<clyybber> @exelotl Hmm, do you include them right now?
19:33:50FromDiscord<clyybber> Oh, I see your issue. I guess if every entity should be able to talk to every other entity there are going to be issues
19:34:45FromDiscord<clyybber> @exelotl I guess you could make a macro that takes a stmtlist and generates forward declarations for all proc definitions it find there?โ†ตThen you could do `nameOfThatMacro: include yourmodule`
19:34:58FromDiscord<clyybber> And then later on include the module regularily
19:35:05FromDiscord<clyybber> then you can have recursive dependencies
19:35:19FromDiscord<clyybber> as it's all like one big module where every proc is forward declared sort of
19:35:46FromDiscord<exelotl> I see, yeah that would work probably
19:36:31FromDiscord<exelotl> project is already big and cluttered enough that I don't want to go introducing new wild ideas like that yet. xD
19:37:08FromDiscord<clyybber> hehe what are you doing currently to work around the limitation?
19:38:20FromDiscord<exelotl> in simple cases I forward declare the proc at the top of the module _before_ the offending import, or just move the offending import down to the first place where it's needed
19:38:39FromDiscord<exelotl> in complex cases I {.exportc.} the proc and {.importc.} it in the other module ๐Ÿ˜…
19:39:56FromDiscord<clyybber> hoho that's a hack :D
19:40:16FromDiscord<clyybber> but if it works it works
19:42:50FromDiscord<exelotl> yeah it doesn't feel great but at the end of the day I'm trying to ship something... and I haven't run into any gotchas from the workaround yet
19:43:15FromDiscord<clyybber> yeah, it should work fine
19:44:52FromDiscord<clyybber> liblq-dev: I just checked, they are not addressing this issue
19:45:14liblq-devsad
19:45:39FromDiscord<clyybber> FWIW generics only bind overloaded symbols late by default
19:46:41FromDiscord<clyybber> but I think the default rules could be adapted a bit to make it more intuitive I suppose
19:47:44FromDiscord<clyybber> although there's the question of going always mixin or always bind by default. Currently we go "mixing by default when symbol is overloaded; bind when symbol isn't" afaict
19:52:10FromDiscord<exelotl> Concrete example: I have one module per "scene" in my game. When the player goes through a door, I need to be able to transition from one scene to any other scene. So I have a "go to scene by ID" proc whichevery door needs to be able to call. That proc needs to have every scene imported... but the scenes contain doors! So, by necessity, not every scene will be defined by the time that proc definition is encountered.
19:52:54FromDiscord<exelotl> So that's a case where I said "fuck it" and used the exportc hack :P
19:53:42FromDiscord<exelotl> (edit) "whichevery" => "which every"
19:58:17FromDiscord<clyybber> fair
20:12:58*narimiran quit (Ping timeout: 256 seconds)
20:32:40*haxscramper quit (Remote host closed the connection)
21:02:34FromGitter<ynfle> > *<FromDiscord>* <Livingstone> In reply to @ynfle "<@263060627793248278> โŽ โŽ": that's to make a csv not unpack one but I got it to work so it's fine โŽ โŽ @Livingstone, It's most certainly not, the `createCsv` is badly named, but it parse the csv, take a look again
21:18:55*MIF joined #nim
21:18:59MIFhi
21:19:07*MIF left #nim ("Sturtz Network https://sturtz.cf")
21:46:47*tane joined #nim
21:47:32FromDiscord<Hi02Hi> hi ๐Ÿ™‚
21:47:37FromDiscord<Livingstone> Ok so I've done looking into my problem with my code and is there a place holder value that I can assign
21:47:43FromDiscord<Livingstone> that doesn't do anything
21:48:19FromDiscord<ElegantBeef> Uncertain what you mean a placeholder
21:48:35FromDiscord<Livingstone> I have a sequence of (a, b)
21:48:49FromDiscord<Livingstone> I want to make b unable to do anything
21:48:52FromDiscord<Livingstone> but not delete it
21:49:06FromDiscord<ElegantBeef> But data doesnt do anything
21:49:17FromDiscord<Livingstone> yeah the b element does nothing
21:49:29Prestigecan you share the code?
21:50:59FromDiscord<Livingstone> line 78 is the place I want to assign a place holder
21:51:00FromDiscord<Livingstone> https://play.nim-lang.org/#ix=2Tfg
21:54:18Prestigejust remove the last element of the seq?
21:54:52FromDiscord<Livingstone> no it's got to do with keeping the numbers in the right positions
21:54:56FromDiscord<Livingstone> I can't remove it
21:55:14FromDiscord<Livingstone> or rather keeping the size of the sequence correct
21:55:25FromDiscord<Livingstone> if I remove it then a bunch of calculations get thrown off
21:55:45FromDiscord<Livingstone> unless you just did it and it worked fine
22:02:53FromDiscord<Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2Tfm
22:04:42FromDiscord<Livingstone> result.add was a extra line that should have been deleteed
22:04:47FromDiscord<Livingstone> I just forgot it
22:05:53FromDiscord<Hi02Hi> once i removed that line and fixed the proc type, it compiled fine
22:07:04FromDiscord<Livingstone> you changed the rmse metric proc type?
22:07:55FromDiscord<Hi02Hi> no, you wanted to `return rmse`, a float, so i changed `evaluate_algorithm` to return a float
22:10:15FromDiscord<Livingstone> 78, 22) Error: type mismatch: got <seq[seq[float]], BackwardsIndex, int literal(0)>โ†ตbut expected one of:
22:10:31FromDiscord<Livingstone> template/generic instantiation of `evaluate_algorithm` from here
22:10:37FromDiscord<Livingstone> the two remaining errors
22:12:11FromDiscord<Hi02Hi> im pretty sure that `[^1]` is the last element, and `[^0]` isnt
22:13:16FromDiscord<Livingstone> I assigned row[^1] = 0, so the last element equals zero
22:13:30*Vladar quit (Quit: Leaving)
22:14:35FromDiscord<Hi02Hi> i think row is immutable, no?โ†ต`for row in dataset:` would be immutable
22:15:03FromDiscord<ElegantBeef> yes
22:16:19FromDiscord<Livingstone> so do I have to assign row to another var and change that?
22:16:26FromDiscord<Livingstone> and then add that on?
22:16:34FromDiscord<Solitude> no, iterate with dataset.mitems
22:18:19FromDiscord<Hi02Hi> `for row in dataset.mitems:`
22:19:18FromDiscord<Hi02Hi> also, dataset is not passed as a `var seq[seq[float]]`
22:29:03*superbia quit (Ping timeout: 246 seconds)
22:29:32FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tfp
22:29:37FromDiscord<Livingstone> this is the error in its entirety
22:34:08FromDiscord<Hi02Hi> is dataset a var param?
22:35:19FromDiscord<Livingstone> yes
22:36:14FromDiscord<Solitude> you are assigning float to sequence of floats
22:37:25FromDiscord<Yardanico> @dub hi if GT EU what if a float self-identifies as a sequence of floats?
22:37:46FromDiscord<Solitude> In reply to @Yardanico "<@!104136074569211904> what if a": shoudve declared a converter or gtfo
22:37:59FromDiscord<Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2Tfr
22:40:56FromDiscord<fwsgonzo> is it possible to calculate CRC32 checksums at compile time?
22:41:06FromDiscord<Yardanico> of course
22:41:12FromDiscord<Yardanico> you can do almost anything at compile-time
22:41:24FromDiscord<fwsgonzo> cool
22:41:41FromDiscord<Yardanico> for example compile brainfuck to nim code at compile time
22:41:55FromDiscord<Yardanico> https://github.com/def-/nim-brainfuck
22:42:56*Gustavo6046_ joined #nim
22:43:12*Gustavo6046 quit (Ping timeout: 244 seconds)
22:45:06*Gustavo6046_ is now known as Gustavo6046
22:46:07FromDiscord<Hi02Hi> found this: http://rosettacode.org/wiki/CRC-32#Nim
22:46:52*PMunch quit (Quit: leaving)
22:47:27FromDiscord<Livingstone> nim(49) sysFatalโ†ตError: unhandled exception: index 101 not in 0 .. 100 [IndexDefect]
22:48:32FromDiscord<Hi02Hi> does it show the trace it followed?
22:50:50FromDiscord<Livingstone> sent a code paste, see https://paste.rs/WUm
22:51:11FromDiscord<Yardanico> yes because you have wrong code in covariance
22:51:18FromDiscord<Yardanico> it's ..<x.len not ..x.len
22:51:33FromDiscord<Livingstone> I changed that already
22:51:38FromDiscord<Yardanico> anyway, I made your code a bit more idiomatic https://play.nim-lang.org/#ix=2Tfu
22:51:45FromDiscord<Yardanico> works for me with this https://media.discordapp.net/attachments/371759389889003532/821878497068318730/unknown.png
22:51:53FromDiscord<Yardanico> if your csv file has a different separator, change it
22:53:46FromDiscord<Yardanico> works for me just fine
22:53:53FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/821879036467871744/unknown.png
22:53:56FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/821879048325169182/unknown.png
22:54:49FromDiscord<Yardanico> but please, try to write some nim code from scratch without translating it from other languages to understand the language itself
22:58:39*rockcavera quit (Read error: Connection reset by peer)
22:59:02*rockcavera joined #nim
23:03:26*tane quit (Quit: Leaving)
23:03:58*koltrast_ quit (Remote host closed the connection)
23:04:11*koltrast joined #nim
23:08:19FromDiscord<ElegantBeef> Damn i was too hopeful, nim threads dont work on the pico
23:08:45FromDiscord<Yardanico> doesn't pico has some RTOS porting to it?
23:08:51FromDiscord<Yardanico> like FreeRTOS to which we have some support in the stdlib
23:09:08FromDiscord<ElegantBeef> Not a clue, i'm just porting the stdlib
23:10:46FromDiscord<ElegantBeef> My knowledge of embedded and C is rather limited
23:23:47FromDiscord<zidsal> nim supports multiple locations for configuration files and the compiler usage guide defines the order and says later files overwrite previous settings. Does this mean all settings or just settings with the same name i.e if file A adds in `--gc:arc` and file B does not which gc gets used?
23:24:29FromDiscord<Yardanico> @zidsal settings with the same name of course
23:24:48FromDiscord<Yardanico> if you have gc:arc in global config but define gc:refc in project config, then the latter will be applied
23:24:57FromDiscord<zidsal> ok that was what I expected, I just wanted to make sure it all inherits nicely
23:25:19FromDiscord<Yardanico> just don't forget that some defines wouldn't work in configs because configs go from default ones to user ones (they're the last to evaluate)
23:25:23FromDiscord<Yardanico> like -d:release -d:danger
23:25:25FromDiscord<Yardanico> -d:lto
23:25:49FromDiscord<Yardanico> basically anything that is checked against in the default nim config
23:26:02FromDiscord<zidsal> ah ok