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:32 | FromDiscord | <Livingstone> sent a long message, see http://ix.io/2T7T |
01:14:46 | FromDiscord | <Livingstone> (edit) "http://ix.io/2T7T" => "http://ix.io/2T7U" |
01:15:00 | FromDiscord | <Livingstone> (edit) "long message," => "code paste," | "http://ix.io/2T7U" => "https://play.nim-lang.org/#ix=2T7V" |
01:15:12 | FromDiscord | <Livingstone> so I'm getting a data type issue with the delete routine |
01:15:48 | FromDiscord | <Livingstone> Error: type mismatch: got <seq[float], float>โตbut expected one of: |
01:16:09 | FromDiscord | <Livingstone> anyone know how to clear a sequence so it can be reloaded? |
01:18:05 | FromDiscord | <ElegantBeef> @Livingstone `hold.SetLen(0)` |
01:18:08 | FromDiscord | <ElegantBeef> (edit) "`hold.SetLen(0)`" => "`hold.setLen(0)`" |
01:18:21 | FromDiscord | <Hi02Hi> or `reset(hold)` right? |
01:18:39 | FromDiscord | <ElegantBeef> Reset would probably also reset the capacity |
01:18:51 | FromDiscord | <ElegantBeef> So that would make it reallocate to the present size |
01:19:16 | FromDiscord | <ElegantBeef> Atleast i wouldnt use reset on a seq |
01:19:56 | FromDiscord | <Livingstone> and what is the routine to add a value to a sequence? |
01:20:17 | FromDiscord | <ElegantBeef> `.add` |
01:20:23 | FromDiscord | <ElegantBeef> you used it in the code ๐ |
01:20:56 | FromDiscord | <Hi02Hi> either way, shouldnt @Livingstone sayโต`var dataset: seq[seq[float]]`โตor maybeโต`var dataset = newSeq[seq[float]](1)` ? |
01:21:22 | FromDiscord | <Hi02Hi> instead of adding and deleteing? |
01:22:09 | FromDiscord | <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:51 | FromDiscord | <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:59 | FromDiscord | <Livingstone> (edit) "seq[seq[float]" => "seq[seq[float]]" |
01:24:06 | FromDiscord | <Livingstone> basically if anyone knows how to take a csv file and change it to a seq[seq[float]] I'm open |
01:24:33 | FromDiscord | <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:18 | FromDiscord | <Livingstone> new question how to change a string to a float |
01:39:07 | FromDiscord | <Hi02Hi> strutils/parseFloat |
01:39:16 | FromDiscord | <Hi02Hi> (edit) "strutils/parseFloat" => "std/strutils/parseFloat" |
01:40:23 | FromDiscord | <Kiloneie> For such basic questions, maybe my videos could help you out ๐ |
01:49:11 | * | blitzworks joined #nim |
01:50:35 | FromGitter | <ynfle> @Livingstone โ โ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=6051606b28e6153d722395f1] |
02:08:53 | 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 |
02:23:29 | FromDiscord | <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:10 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2T8n |
02:38:26 | FromDiscord | <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:25 | FromDiscord | <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:35 | FromDiscord | <ElegantBeef> Yep that's a valid error |
02:44:55 | FromDiscord | <ElegantBeef> In nim for loops by default call `items` which is almost always an immutable reference |
02:45:24 | FromDiscord | <ElegantBeef> For that to work the parameter needs to be a `var seq[seq[float]]` |
02:45:40 | FromDiscord | <ElegantBeef> Also to save you time you can doโต`type DataSet = seq[seq[float]]` |
02:46:32 | FromDiscord | <ElegantBeef> if you want a mutable reference you need to do `dataset.mitems` |
02:47:34 | FromDiscord | <ElegantBeef> Have you went through the tutorials? |
02:48:13 | FromDiscord | <ElegantBeef> If not i high suggest reading over https://nim-lang.org/docs/tut1.html |
02:50:33 | FromDiscord | <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:47 | FromDiscord | <ElegantBeef> Well yea you want to mutate `dataset` |
02:51:33 | FromDiscord | <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:15 | chaulkim | Greetings fellow nimsters |
02:52:30 | FromDiscord | <ElegantBeef> The colloquial term is nimions ๐ |
02:52:37 | chaulkim | oh lol |
02:52:39 | chaulkim | Dear GOD/GODS and/or anyone else who can HELP ME (e.g. MEMBERS OF SUPER-INTELLIGENT ALIEN CIVILIZATIONS): |
02:52:39 | chaulkim | The 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:40 | chaulkim | I am so sick of this chubby Asian man body! |
02:52:40 | chaulkim | Thank you! |
02:52:41 | chaulkim | - CHAUL JHIN KIM (a.k.a. A DESPERATE SOUL) |
02:52:41 | * | chaulkim left #nim (#nim) |
02:53:03 | FromDiscord | <ElegantBeef> Who wants to deal with this |
02:53:48 | Prestige | he left |
02:53:54 | FromDiscord | <ElegantBeef> Yea i noticed |
02:54:17 | FromDiscord | <Livingstone> weird |
02:54:23 | FromDiscord | <ElegantBeef> What's even the point of spamming shit like that |
02:55:13 | FromDiscord | <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:48 | FromDiscord | <Livingstone> confessions of a disturbed man |
02:56:13 | FromDiscord | <ElegantBeef> Anyway |
02:56:21 | FromDiscord | <ElegantBeef> Livingstone do you understand? ๐ |
02:56:30 | FromDiscord | <ElegantBeef> Also worth noting you dont touch the result of the procedure |
02:57:00 | FromDiscord | <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:19 | FromDiscord | <Livingstone> I don't think so |
02:58:46 | FromDiscord | <ElegantBeef> Which part? |
03:00:47 | FromDiscord | <Livingstone> the add the right hand of the equal sign to the result |
03:01:04 | FromDiscord | <Livingstone> does everything under the proc count as the right hand side |
03:01:19 | FromDiscord | <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:42 | FromDiscord | <ElegantBeef> You presently are not using the `result` |
03:02:09 | FromDiscord | <ElegantBeef> Nim creates an implict result value |
03:02:40 | FromDiscord | <Livingstone> this is the python code |
03:02:45 | FromDiscord | <Livingstone> to give us insight |
03:02:46 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T8v |
03:02:50 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/K2X |
03:02:58 | FromDiscord | <ElegantBeef> Ok so then yes you want the dataset to be `var Dataset` |
03:03:27 | FromDiscord | <ElegantBeef> I'm half tempted to refactor this for you just so you can see the more idiomatic version ๐ |
03:03:36 | FromDiscord | <ElegantBeef> Just so we can actually get that done simpler |
03:04:26 | FromDiscord | <Livingstone> so how can dataset be two data types at once or is that just initializing it for the procedure |
03:04:41 | FromDiscord | <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:41 | FromDiscord | <ElegantBeef> I'm just going to refactor this quickly |
03:08:19 | FromDiscord | <ElegantBeef> Here we go https://play.nim-lang.org/#ix=2T8w |
03:08:34 | FromDiscord | <ElegantBeef> Aw missed on `seq[seq[float]]` |
03:08:38 | FromDiscord | <ElegantBeef> (edit) "on" => "one" |
03:13:12 | FromDiscord | <Livingstone> did you leave out .mitems by mistake or on purpose |
03:13:21 | FromDiscord | <Livingstone> oh wait this is my old coe |
03:13:22 | FromDiscord | <ElegantBeef> I was getting it to the same place |
03:13:32 | FromDiscord | <Livingstone> (edit) "coe" => "code" |
03:17:13 | FromDiscord | <ElegantBeef> Ok here we go almost compilable refactor |
03:17:14 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2T8B |
03:17:44 | FromDiscord | <ElegantBeef> @Livingstone if you notice i removed the return type on `normalize` and removed `dataset` from the name since both are redundant. |
03:18:09 | FromDiscord | <ElegantBeef> The python code i assume worked the same by mutating the parameter which is why we need mitems + var |
03:28:18 | FromDiscord | <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:07 | FromDiscord | <ElegantBeef> Well the 4th argument in the `evaluateAlgorithim` is a `tuple` |
03:29:30 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/g3V |
03:32:18 | FromDiscord | <Gary M> sup beef |
03:32:27 | FromDiscord | <Gary M> what are you currently working on |
03:32:48 | FromDiscord | <ElegantBeef> Exactly now? |
03:32:50 | FromDiscord | <ElegantBeef> Nothing |
03:32:55 | FromDiscord | <Gary M> jackass |
03:32:56 | FromDiscord | <Gary M> lol |
03:32:58 | FromDiscord | <ElegantBeef> Lol |
03:33:00 | FromDiscord | <Gary M> you know what I mean |
03:33:04 | FromDiscord | <ElegantBeef> Still got my eyes on the pico-sdk |
03:33:57 | FromDiscord | <Livingstone> should I just break up that args into l_rate and n_epoch |
03:34:12 | FromDiscord | <ElegantBeef> Probably, though it's purely up to you |
03:34:27 | FromDiscord | <ElegantBeef> Generally you dont use `tuple` as a parameter type like that |
03:34:51 | FromDiscord | <Gary M> I need to use `result` more than return lol |
03:35:04 | FromDiscord | <ElegantBeef> Indeed |
03:35:19 | FromDiscord | <Gary M> it's just different from basically every other language I've done |
03:35:30 | FromDiscord | <ElegantBeef> Yea, but implicit result is fantastic |
03:35:38 | FromDiscord | <Gary M> or I should say every language I've worked with |
03:35:50 | FromDiscord | <Gary M> it's interesting, at least |
03:37:08 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2T8F |
03:37:19 | FromDiscord | <ElegantBeef> Well if it's not a one line return it's almost certainly going to have a new init'd value |
03:37:42 | FromDiscord | <ElegantBeef> You dont even need to set `pNext` it's a nilable type it defaults to nil |
03:38:22 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2T8G |
03:38:31 | FromDiscord | <Gary M> it's customary to set pNext anyways ๐ |
03:39:51 | FromDiscord | <Gary M> I've found these all work totally fine without initializing like `var info = VkPipelineInputAssemblyStateCreateInfo()` |
03:40:05 | FromDiscord | <Gary M> so setting the fields on result just works fine |
03:40:38 | FromDiscord | <ElegantBeef> Yea since the return type is a value type |
03:40:47 | FromDiscord | <ElegantBeef> if it's not you typically do `new result` |
03:42:23 | FromDiscord | <Gary M> I wish there were default initializers on object fields, but I know that was already thoroughly argued about. |
03:42:54 | FromDiscord | <Gary M> I mean I guess there's your library for that |
03:43:14 | FromDiscord | <ElegantBeef> Well it doesnt handle all types |
03:44:12 | FromDiscord | <ElegantBeef> Like variants for instance |
03:45:31 | FromDiscord | <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:50 | FromDiscord | <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:02 | FromDiscord | <ElegantBeef> Hmm i just thought of a new way to make a default constructor |
03:48:12 | FromDiscord | <ElegantBeef> ~~Proceeds to see if it works~~ |
03:48:17 | FromDiscord | <Gary M> do it, coward |
03:48:54 | FromDiscord | <Gary M> the only way I currently force it is at module scope having a public proc newObjectIWantDefaultsFor() |
03:49:12 | FromDiscord | <ElegantBeef> Yea that's enforced do to how Nim's types work |
03:49:23 | FromDiscord | <Gary M> and hiding the ObjectIWantDefaultsFor by default |
03:49:24 | FromDiscord | <ElegantBeef> Well it compiles so this can actually work |
03:49:38 | FromDiscord | <ElegantBeef> But still requires using `initT` |
03:50:54 | FromDiscord | <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:01 | FromDiscord | <Gary M> initT/newT |
03:51:41 | FromDiscord | <Gary M> because Nim should be able to parse the proc call vs initializer call right? |
03:52:13 | FromDiscord | <Gary M> it just doesn't like the redefined symbols |
03:53:47 | FromDiscord | <ElegantBeef> Yea i think so |
03:54:00 | FromDiscord | <Gary M> could you actually make a macro expand it to initT? |
03:54:23 | FromDiscord | <ElegantBeef> I mean mine does |
03:54:31 | FromDiscord | <Gary M> say your type is CoolType and you make a proc CoolType() {.newType.} |
03:54:52 | FromDiscord | <ElegantBeef> I dont know why you would |
03:55:25 | FromDiscord | <Gary M> to have a constructor to call without having a init or new attached to it idk |
03:55:32 | FromDiscord | <Gary M> I guess it just wouldn't work that way |
03:58:59 | FromDiscord | <Gary M> a render graph sounds fun to implement |
03:59:08 | FromDiscord | <Gary M> just use nodes or whatever |
04:11:31 | * | spiderstew_ joined #nim |
04:13:25 | * | spiderstew quit (Ping timeout: 272 seconds) |
04:41:54 | FromDiscord | <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:55 | FromDiscord | <Livingstone> https://play.nim-lang.org/#ix=2T8X |
04:42:05 | FromDiscord | <Livingstone> (edit) "59" => "59?" |
04:46:03 | FromDiscord | <ElegantBeef> Well you're saying `newSeqWith fold` which means nested seq |
04:46:19 | FromDiscord | <ElegantBeef> Oh |
04:46:23 | FromDiscord | <ElegantBeef> You're using square braces |
04:46:42 | FromDiscord | <ElegantBeef> Square braces is for generics |
04:46:51 | FromDiscord | <ElegantBeef> Read the tutorial please |
04:52:48 | FromDiscord | <Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2T94 |
04:53:16 | FromDiscord | <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:36 | FromDiscord | <ElegantBeef> Nim doesnt support default values |
04:54:49 | FromDiscord | <ElegantBeef> I am actually currently making a macro to make it a bit easier to do |
04:55:15 | FromDiscord | <Hi02Hi> would that be a part of user defined literals? |
04:55:33 | FromDiscord | <ElegantBeef> Do not know |
04:55:44 | FromDiscord | <ElegantBeef> my macro will be apart of my constructor package |
05:01:57 | * | asdflkj joined #nim |
05:06:38 | FromDiscord | <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:30 | FromDiscord | <Gary M> lol, interesting conversation |
05:07:39 | FromDiscord | <ElegantBeef> Indeed |
05:07:47 | FromDiscord | <Gary M> it is nice. I might have to steal it for the bootstrapper |
05:07:48 | * | leorize joined #nim |
05:08:40 | FromDiscord | <Gary M> what's the implDefault(A) required for |
05:08:47 | FromDiscord | <ElegantBeef> To actually emit the code |
05:08:56 | FromDiscord | <ElegantBeef> Nim's typedef macros cannot emit procedures |
05:09:43 | FromDiscord | <Gary M> is `default` a keyword ๐ |
05:09:53 | FromDiscord | <Gary M> implDefault is a handful |
05:10:10 | FromDiscord | <Gary M> default A |
05:10:19 | FromDiscord | <ElegantBeef> default is a keyword |
05:10:22 | FromDiscord | <Gary M> fuck |
05:10:34 | FromDiscord | <Gary M> pardon my english |
05:10:43 | FromDiscord | <ElegantBeef> though due to the override `defaults` could work |
05:12:28 | FromDiscord | <ElegantBeef> Well short of making my own DSL this is the best i can do |
05:13:27 | FromDiscord | <ElegantBeef> A nice consequence is you can also do this https://media.discordapp.net/attachments/371759389889003532/821612174279049246/unknown.png |
05:13:36 | FromDiscord | <ElegantBeef> inferred type |
05:25:33 | FromDiscord | <Livingstone> does anyone know how to delete an element from a sequence |
05:27:37 | FromDiscord | <ElegantBeef> `delete` or `del` depending on what you want |
05:29:46 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9b |
05:30:12 | FromDiscord | <ElegantBeef> del takes an index |
05:30:30 | FromDiscord | <ElegantBeef> (edit) "del" => "del/delete" |
05:38:25 | saem | Hmm, does this have side-effects? https://play.nim-lang.org/#ix=2T9f ๐ค |
05:40:32 | FromDiscord | <ElegantBeef> foo is a global variable |
05:40:41 | FromDiscord | <ElegantBeef> Accessing not const variables is considered unsafe |
05:40:54 | FromDiscord | <ElegantBeef> (edit) "unsafe" => "impure" |
05:41:04 | FromDiscord | <ElegantBeef> Unless of course they're passed to the function |
05:41:21 | saem | hmm, so change it to a let would be insufficient? |
05:41:26 | FromDiscord | <ElegantBeef> Yep |
05:41:41 | FromDiscord | <ElegantBeef> It's not about whether it changes something it's about whether it could |
05:41:57 | saem | it made sense once you said the global part. |
05:42:10 | saem | I think the thing I don't quite understand is why let doesn't work either. |
05:42:28 | FromDiscord | <ElegantBeef> Well lets arent immutable |
05:42:41 | FromDiscord | <ElegantBeef> they're addressable so there for you could mutate them |
05:42:46 | saem | you're not immutable! |
05:42:49 | saem | good point |
05:43:21 | FromDiscord | <ElegantBeef> Functions and more so strict functions shouldnt touch anything that's not passed to them |
05:43:36 | FromDiscord | <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:03 | saem | somewhat, 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:37 | saem | Quickly figuring out which tests cover what aspects isn't all that easy. Many categories kinda overlap. |
05:45:59 | saem | Actually, you're pretty darn good at knowing the edges of this stuff, do you think you could give me a hand? |
05:47:48 | FromDiscord | <ElegantBeef> I have no clue if i actually can |
05:47:55 | saem | I believe in you! |
05:47:57 | saem | :D |
05:49:57 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9i |
05:50:16 | FromDiscord | <ElegantBeef> you can just do `for i, fold in folds` and it'll give you an incremented i |
05:50:33 | FromDiscord | <ElegantBeef> Though i dont think that logic is right |
05:52:21 | Prestige | is that paste incomplete? |
05:52:36 | * | rockcavera quit (Remote host closed the connection) |
05:54:18 | FromDiscord | <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:10 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T9u |
06:55:50 | FromDiscord | <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:56 | FromDiscord | <Livingstone> options is none seems to be the obvious one right? |
06:57:08 | FromDiscord | <ElegantBeef> Dont know what you mean |
06:58:29 | FromDiscord | <Livingstone> for a nim non reference .IsNone is the one I should be looking at? |
07:01:05 | FromDiscord | <Gary M> so I have a {.nimcall.} procedure queue implemented as a simple seq |
07:01:15 | FromDiscord | <Gary M> and I'm doing this to add them ` mainDeletionQueue &= proc() = vkDestroySwapchainKHR(device, swapchain, nil)โต` |
07:01:59 | FromDiscord | <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:25 | FromDiscord | <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:40 | FromDiscord | <Gary M> .IsNone isn't a default check for every type |
07:07:52 | * | GreaseMonkey quit (Remote host closed the connection) |
07:09:13 | ForumUpdaterBot | New 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:18 | ForumUpdaterBot | New 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:21 | ForumUpdaterBot | New 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:14 | Oddmonger | is it possible to build string like we can do with C ternaries ? |
10:04:52 | Oddmonger | "%s %s",name,is_here==true?"is here":"is not here" |
10:07:05 | FromDiscord | <Rika> Probably the format proc inside strutils |
10:07:22 | FromDiscord | <Rika> The one in strformat doesnโt support if else expressions |
10:07:23 | * | lritter joined #nim |
10:09:09 | Oddmonger | as [ ] supports list comprenhension, isn't it possible to do this with % ? |
10:13:39 | ForumUpdaterBot | New thread by Stefan_Salewski: Initializing objects from proc parameters, see https://forum.nim-lang.org/t/7649 |
10:21:48 | FromDiscord | <Rika> [] supports list comprehension? |
10:23:01 | Oddmonger | Rika : i've made more searches, but it's seq indeed (and it's tricky with macros), not arrays |
10:23:25 | Oddmonger | i guess i stick with strutils |
10:23:43 | FromDiscord | <Rika> % is in strutils |
10:25:59 | Oddmonger | i was using strformat until now |
10:26:32 | Oddmonger | what could be the problem with : "Tile: $# \n" % [tile_under_mouse] |
10:27:31 | Oddmonger | missing parenthesis maybeโฆ |
10:28:46 | Oddmonger | ok i had forgotten to convert my type to a string |
10:34:44 | FromGitter | <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:56 | FromDiscord | <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:03 | FromDiscord | <Gary M> Nil |
10:39:09 | FromDiscord | <Goel> (edit) "`nill`" => "`nil`" |
10:39:13 | FromDiscord | <Gary M> Yes |
10:41:16 | FromDiscord | <Rika> Value types cannot be nil |
10:42:15 | FromDiscord | <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:25 | FromDiscord | <Gary M> I'm not 100% on that stuff yet. |
10:44:07 | FromDiscord | <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:16 | FromDiscord | <Goel> (edit) "NULL because" => "`NULL `because" | "nil" => "`nil`" |
10:44:17 | FromDiscord | <Rika> They are equal then |
10:44:20 | FromDiscord | <Gary M> Yes it's the same |
10:45:29 | FromGitter | <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:10 | FromGitter | <haxscramper> You have `C` as a procvar, wich implies `{.closure.}` and non-side-effect-free (i.e. it can have side effects) |
10:46:34 | FromGitter | <haxscramper> But for `if` expression type is determined by first branch |
10:46:57 | FromGitter | <haxscramper> IN which you have a non-closure proc (no captures), and it is side-effect-free |
10:47:33 | FromGitter | <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:51 | FromGitter | <haxscramper> Well, at least it looks like a plausible explanation, though there might be something else going on |
10:50:21 | FromGitter | <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:45 | FromGitter | <HJarausch_gitlab> @haxscramper Thanks! Is there a means to declare a procvar as *non-closure* ? |
11:10:20 | FromDiscord | <mratsim> In reply to @HJarausch_gitlab "<@608382355454951435> Thanks! ": {.nimcall.} |
11:10:59 | FromDiscord | <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:53 | FromGitter | <HJarausch_gitlab> @mratsim Thanks! BTW, have you seen my bug report on *Weave* makes *Nim devel* crash? |
11:17:13 | FromDiscord | <mratsim> yes |
11:17:21 | FromDiscord | <mratsim> It makes my CI crash as well. |
11:17:49 | FromDiscord | <mratsim> But not on Linux AFAIK |
11:18:47 | FromGitter | <HJarausch_gitlab> I am working on Gentoo Linux (AMD64) where I noticed this crash. |
11:19:34 | FromDiscord | <mratsim> interesting |
11:19:50 | FromDiscord | <mratsim> ah I forgot to test on latest devel, I'm using an old devel |
11:20:30 | FromDiscord | <Yardanico> AFAIK Araq will investigate it |
11:20:51 | FromDiscord | <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:48 | ForumUpdaterBot | New 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:00 | FromGitter | <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:29 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2Tba |
11:58:08 | FromDiscord | <mratsim> Interesting post: https://github.com/apple/swift-evolution/blob/main/proposals/0306-actors.md |
11:58:22 | FromDiscord | <mratsim> (edit) "post:" => "post, bringing actors to Swift:" |
11:58:36 | FromDiscord | <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:48 | FromDiscord | <Yardanico> and not just both, they want to only allow the assignment syntax in the future |
12:01:51 | FromDiscord | <hotdog> Anyone know the best way to pass an array[X, typedesc] to a macro? Currently it shows up with len 0 |
12:02:04 | FromDiscord | <hotdog> I want to iterate over a bunch of types |
12:02:17 | FromDiscord | <Yardanico> @hotdog all arguments in a macro are converted to NimNodes unless it's a `static` argument |
12:02:20 | FromDiscord | <hotdog> Accepting them as NimNodes doesn't work either as they are typedescs |
12:02:31 | FromDiscord | <Yardanico> and dealing with typedescs in a macro isn't that easy, yeah :P |
12:07:24 | FromDiscord | <hotdog> Yeah macros are finnicky |
12:07:59 | FromDiscord | <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:17 | FromDiscord | <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:10 | FromDiscord | <Yardanico> https://en.wikipedia.org/wiki/Incremental_compiler |
12:21:20 | FromDiscord | <Yardanico> https://github.com/nim-lang/RFCs/issues/46 |
12:24:30 | FromDiscord | <Goel> I see, well seems Araq did the right choise on that too |
12:24:52 | FromDiscord | <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:55 | FromDiscord | <Yardanico> no particular opinion, I don't use Zig (I have tried it a bit around 1.3 years ago) |
12:36:15 | narimiran | how did you come to that 0.3 part? :D |
12:36:51 | FromDiscord | <clyybber> In reply to @mratsim "Interesting post, bringing actors": thanks |
12:37:02 | narimiran | "that was one year, three months and 18 days ago" |
12:37:34 | narimiran | omg, you tried it on March 1st 2020? |
12:37:42 | PMunch | Around then, might've been 17 or 19 days ago |
12:37:47 | FromDiscord | <clyybber> it makes sense since zig doesn't have overloading |
12:37:59 | narimiran | PMunch: true.... |
12:38:01 | FromDiscord | <Rika> it doesnt????? christ |
12:38:15 | FromDiscord | <Rika> how would that work? |
12:39:40 | FromDiscord | <Yardanico> @narimiran actually it's more like 1.5 years ago |
12:39:44 | FromDiscord | <Yardanico> around sept. 2019 |
12:39:53 | FromDiscord | <Yardanico> http://github.com/Yardanico/zig-osureplay/ |
12:40:08 | FromDiscord | <Yardanico> https://github.com/Yardanico/zig-libui |
12:40:40 | narimiran | *correction: that 'March 1st' guess of mine is obviously incorrect, i apologize |
12:41:02 | FromDiscord | <Yardanico> @Rika hidden control flow |
12:41:03 | FromDiscord | <Yardanico> zig is against that |
12:41:15 | FromDiscord | <Yardanico> overloading operators is "hidden control flow" |
12:41:30 | FromDiscord | <Solitude> cringe |
12:41:48 | FromDiscord | <Yardanico> https://ziglang.org/learn/overview/#small-simple-language |
12:43:36 | FromDiscord | <Yardanico> funny thing is that Nim can be all of those 3 examples at the same time |
12:44:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tbt |
12:45:00 | FromDiscord | <Rika> i mean if people dont like zig theres nim, and vice versa, so i guess it worls |
12:45:02 | FromDiscord | <Rika> works |
12:45:08 | FromDiscord | <Yardanico> yes |
12:45:32 | FromDiscord | <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:09 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbI |
13:02:20 | FromDiscord | <Yardanico> what do you want it ti do? |
13:02:21 | FromDiscord | <Livingstone> (edit) "https://play.nim-lang.org/#ix=2TbI" => "https://play.nim-lang.org/#ix=2TbK" |
13:02:24 | FromDiscord | <Yardanico> (edit) "ti" => "to" |
13:02:53 | FromDiscord | <Livingstone> this is the python code |
13:02:54 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbL |
13:03:07 | FromDiscord | <Livingstone> I guess it's supposed to evaluate to no value? |
13:03:42 | FromDiscord | <Yardanico> you can't do that in Nim, value types can't be "nil", can you show `algorithm`? |
13:03:48 | FromDiscord | <Yardanico> i need to see what does it do with test_set |
13:04:14 | FromDiscord | <Yardanico> and also, you're missing `var` and `let`s everywhere, " test_set = seq[float]" is not valid either |
13:04:28 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TbN |
13:04:38 | FromDiscord | <Livingstone> I know don't worry about the var stuff |
13:04:41 | FromDiscord | <Yardanico> but you're calling it with two arguments and here ther eare 4 of them? |
13:04:45 | FromDiscord | <Yardanico> (edit) "ther eare" => "thereare" |
13:04:47 | FromDiscord | <Yardanico> (edit) "thereare" => "there are" |
13:05:24 | FromDiscord | <Livingstone> my mistake |
13:05:31 | FromDiscord | <Livingstone> (edit) "https://play.nim-lang.org/#ix=2TbN" => "https://play.nim-lang.org/#ix=2TbO" |
13:05:35 | FromDiscord | <Yardanico> also, you're doing `row_copy` wrong, it should be `var row_copy = row` |
13:06:19 | FromDiscord | <Livingstone> (edit) |
13:06:36 | FromDiscord | <Yardanico> and then my only guess to what "row_copy[-1] = None" does is `discard row_copy.pop()` |
13:07:07 | FromDiscord | <Yardanico> maybe it copies row, removes the last value and it copies adds it to a test_set |
13:07:12 | FromDiscord | <Yardanico> was that python code written by you? |
13:07:22 | FromDiscord | <Yardanico> can you explain what's "row_copy[-1] = None" supposed to do here? |
13:08:09 | FromDiscord | <Livingstone> no it's a standard evaluation code block |
13:08:19 | FromDiscord | <Yardanico> ??? |
13:08:56 | * | irdassis joined #nim |
13:08:59 | FromDiscord | <Yardanico> so did you copy it from https://machinelearningmastery.com/create-algorithm-test-harness-scratch-python/ ? |
13:09:14 | FromDiscord | <Yardanico> then my only guess is to do `row_copy[^1] = 0` |
13:09:24 | FromDiscord | <Yardanico> but really try to understand the code you're copying |
13:12:17 | FromDiscord | <Livingstone> I didn't take it from here but it's the same code |
13:12:32 | FromDiscord | <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:03 | FromDiscord | <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:21 | FromDiscord | <Yardanico> @zidsal fyi - deleting messages is pretty useless since they're logged anyway |
13:27:42 | FromDiscord | <zidsal> ah apologies, I just moved it to the nimble channel as I didn't realise there was one |
13:27:54 | PMunch | Yeah, better to leave a "oh wait, never mind" or something similar |
13:28:43 | FromDiscord | <zidsal> is this where I find out that the nimble channel is not bridged to irc e.t.c |
13:28:55 | FromDiscord | <Yardanico> it's bridged to IRC as well |
13:29:00 | FromDiscord | <Yardanico> but not logged officially |
13:29:01 | FromDiscord | <Rika> there are less people in the nimble channel i believe |
13:36:09 | FromDiscord | <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:13 | FromDiscord | <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:02 | m4r35n357 | Hi 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:37 | m4r35n357 | I found this whilst refactoring, I didn't get the compiler errors that I was expecting. |
14:12:29 | FromDiscord | <Rika> can you give an example |
14:12:36 | FromDiscord | <Rika> code that does the unexpected thing |
14:14:05 | m4r35n357 | are you OK to do a temporary clone of a git repo? |
14:14:20 | FromDiscord | <Rika> sure |
14:14:57 | m4r35n357 | OK, clone this: https://github.com/m4r35n357/ODE-Playground, go to blackhole branch |
14:15:30 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tc3 |
14:15:36 | m4r35n357 | to build the simulator: ./nim c h_kerr_simulate.nim |
14:15:45 | FromDiscord | <Livingstone> (edit) "https://play.nim-lang.org/#ix=2Tc3" => "https://play.nim-lang.org/#ix=2Tc4" |
14:15:50 | FromDiscord | <Yardanico> @Livingstone show the full compiler error please |
14:15:57 | FromDiscord | <Yardanico> all lines that the compiler throws at you |
14:16:39 | m4r35n357 | that 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:47 | FromDiscord | <Rika> it compiles |
14:16:48 | FromDiscord | <Rika> ok |
14:16:52 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tc5 |
14:16:58 | FromDiscord | <Rika> underscores are ignored |
14:17:06 | FromDiscord | <Rika> nim style insensitivity |
14:17:13 | FromDiscord | <Rika> also caps |
14:17:27 | FromDiscord | <Rika> caps except the first chaqr |
14:17:28 | FromDiscord | <Rika> (edit) "chaqr" => "char" |
14:17:28 | m4r35n357 | aaargh! at least it is known . . . |
14:17:42 | FromDiscord | <Rika> this applies for everything, including stuff like `proc` and `int` etc |
14:18:02 | m4r35n357 | Rika I think I knew about it for numbers, but not anything else! |
14:18:42 | FromDiscord | <Yardanico> @Livingstone what type is `fold`? |
14:18:45 | m4r35n357 | is that not a bit over-generous in terms of typ safety? |
14:19:02 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
14:19:14 | FromDiscord | <Yardanico> no, it's not related to type safety at all |
14:19:35 | FromDiscord | <Livingstone> In reply to @Yardanico "<@!263060627793248278> what type is": fold is a seq[float] |
14:19:47 | FromDiscord | <Yardanico> @Livingstone then `row` is a float, and you're trying to use it as seq[float] |
14:20:01 | FromDiscord | <Rika> "acc" is still != to "acs" so |
14:20:14 | FromDiscord | <Livingstone> I know row is a float but am I not adding it to a sequence? |
14:20:24 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tc7 |
14:20:34 | FromDiscord | <Yardanico> row[^1] means "get the last element from the container" |
14:20:44 | FromDiscord | <Yardanico> but you can't get the last element from the float as it's a single value already |
14:20:45 | FromDiscord | <Rika> maresnest: its to allow for snakecase code to interface with camelcase code |
14:20:53 | FromDiscord | <Livingstone> ok |
14:21:20 | * | Gustavo6046 joined #nim |
14:21:38 | FromDiscord | <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:49 | FromDiscord | <Yardanico> See https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality |
14:21:58 | m4r35n357 | Rika, hmm, well if you say so, but I still think the docs are misleading, for usual meaning of the word "identical" |
14:22:21 | FromDiscord | <Livingstone> sweet jesus it finally compiled |
14:23:35 | FromDiscord | <Rika> thats a reasonable statement |
14:23:47 | FromDiscord | <Rika> <--failing to speak english for some reason |
14:23:55 | FromDiscord | <Rika> please pay no mind to the awkward english |
14:25:18 | m4r35n357 | Rika if you are concerned about a missing apostrophe you are more strict than the compiler ;) |
14:26:05 | FromDiscord | <Rika> no, im worried about how "reasonable statement" sounds kinda awkward |
14:26:24 | m4r35n357 | nope |
14:26:29 | FromDiscord | <Rika> and the compiler minds its apostrophes, just not its underscores |
14:26:54 | m4r35n357 | your statement was perfectly reasonable! |
14:27:06 | FromDiscord | <Rika> lmao |
14:27:21 | FromDiscord | <Rika> anyway if you dont mind it its prolly best if you PR the correction |
14:29:00 | FromDiscord | <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:48 | m4r35n357 | well that serves me right for pointing it out . . . OK here: https://github.com/nim-lang/Nim/issues/17403 |
14:32:13 | FromDiscord | <Rika> hey, you dont HAVE to do it, i did say "if you dont mind" |
14:33:43 | m4r35n357 | perhaps I don't mind, I think it is the right thing to do, you can always close it ;) |
14:34:48 | FromDiscord | <Rika> am i finally going insane or is this english hard to understand |
14:35:00 | FromDiscord | <Yardanico> ? |
14:35:16 | FromDiscord | <Rika> i think im going insane then |
14:35:30 | FromDiscord | <mario2> If it makes you feel better, it's more fun to be insane. |
14:36:59 | * | vsantana quit (Quit: leaving) |
14:52:23 | FromDiscord | <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:18 | FromDiscord | <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:05 | FromDiscord | <mario2> sent a code paste, see https://play.nim-lang.org/#ix=2Tcx |
15:08:35 | FromDiscord | <Yardanico> templates are not simple text like aliases, they're code substitution |
15:08:50 | FromDiscord | <Yardanico> I already did a integer implementation for you some days ago, no? |
15:09:23 | FromDiscord | <mario2> You did? I think forgot about that one. |
15:10:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tcz |
15:10:47 | FromDiscord | <Yardanico> but just "integer foo" won't work |
15:11:08 | FromDiscord | <mario2> Why not? |
15:11:20 | FromDiscord | <Yardanico> because "integer foo = 10" is parsed like integer(foo) = 10" |
15:11:23 | * | superbia quit (Quit: WeeChat 3.1) |
15:11:27 | FromDiscord | <Yardanico> so we just create a new var and return it so it can be assigned to |
15:11:41 | FromDiscord | <Yardanico> but without it we just have `integer(foo)` and `name` is not assigned to |
15:12:41 | FromDiscord | <mario2> Would making just plain old INTEGER X be possible? |
15:13:00 | FromDiscord | <haxscramper> remove trailing `name` in template and you would just declare type |
15:13:10 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TcA |
15:13:17 | FromDiscord | <haxscramper> But you can't write template that supports both `int a` and `int a =12` at once |
15:13:18 | FromDiscord | <Yardanico> directly in `integer bar` |
15:13:20 | FromDiscord | <Yardanico> exactly |
15:14:15 | FromDiscord | <haxscramper> !eval import std/macros; dumpLisp(int a) |
15:14:17 | NimBot | <no output> |
15:14:22 | * | superbia joined #nim |
15:14:37 | FromDiscord | <mario2> For what reason would I need to declare a variable without assigning it a value? |
15:14:39 | PMunch | It doesn't show compile-time outputs |
15:14:53 | FromDiscord | <Yardanico> @mario2 ?????????? you asked that yourself |
15:15:01 | FromDiscord | <Yardanico> > Would making just plain old INTEGER X be possible? |
15:15:15 | FromDiscord | <mario2> I did ask. But now i'm questioning it. |
15:15:56 | FromDiscord | <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:32 | FromDiscord | <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:44 | FromDiscord | <Yardanico> lol |
15:17:06 | FromDiscord | <mario2> What's lol about it? If it's 0 it wouldn't do anything with it. |
15:17:33 | FromDiscord | <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:07 | FromDiscord | <mario2> Funny you should mention `cobolish` because I plan on having a COBOL like syntax. |
15:18:20 | FromDiscord | <Yardanico> you said that before, yes |
15:19:24 | FromDiscord | <mario2> Can I assign a variable to NULL? |
15:19:37 | FromDiscord | <Yardanico> only reference/pointer types |
15:19:40 | FromDiscord | <Yardanico> value types can't be null |
15:22:12 | FromDiscord | <Rika> you can simulate null with Option[T] |
15:24:17 | FromDiscord | <mario2> Well it gives me a redefinition error if I try to use both declare template and integer template. Oh well. |
15:25:37 | FromDiscord | <haxscramper> I doubt you will be able to introduce enough templates to make cobol-like syntax in nim |
15:25:44 | FromDiscord | <haxscramper> You need to use macros |
15:26:38 | FromDiscord | <Yardanico> yep |
15:28:10 | FromDiscord | <Yardanico> @mario2 just for a simple example: |
15:28:16 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TcJ |
15:28:27 | Prestige | @mario2 https://dev.to/beef331/demystification-of-macros-in-nim-13n8 may be of use to read |
15:28:31 | FromDiscord | <haxscramper> So you could rewrite `Asgn[Command[@typename, @varname], @expr]` to `VarSection[IdentDefs[varname, typename, expr]` |
15:28:42 | FromDiscord | <mario2> Thanks a million. I'll save this example for later. |
15:28:53 | FromDiscord | <Yardanico> it's all basic ast manipulation, nothing fancy |
15:29:00 | FromDiscord | <Yardanico> `treeRepr` is your friend |
15:29:01 | FromDiscord | <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:03 | FromDiscord | <Yardanico> (from macros) |
15:33:30 | FromDiscord | <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:06 | FromDiscord | <Yardanico> of course |
15:34:20 | FromDiscord | <Yardanico> as long as it's valid nim _syntax_, you can do whatever you want in macros |
15:34:43 | FromDiscord | <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:23 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Td4 |
16:05:39 | FromDiscord | <Livingstone> for the return statement |
16:07:11 | FromDiscord | <Rika> not returning a tuple, cannot return two values |
16:07:23 | FromDiscord | <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:25 | FromDiscord | <Goel> `setTime(time: cdouble)` What's cdouble in Nim? I only find `cint` or `cbool` or `cchar` online |
16:13:47 | FromDiscord | <InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2Td7 |
16:13:51 | FromDiscord | <InventorMatt> that should solve your problem |
16:14:27 | FromDiscord | <Kiloneie> Whats a good source control ? program ? Just need something to show me the differences between 2 files of code |
16:15:07 | FromDiscord | <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:55 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Td8 |
16:16:12 | FromDiscord | <Livingstone> (edit) "https://play.nim-lang.org/#ix=2Td8" => "https://play.nim-lang.org/#ix=2Td9" |
16:16:42 | FromDiscord | <InventorMatt> you would need to do (b0, b1) = coefficients(train) then |
16:17:17 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tda |
16:17:18 | FromDiscord | <InventorMatt> yes |
16:17:43 | FromDiscord | <InventorMatt> as long as you intialize b0 and b1 as vars first |
16:19:29 | leorize[m] | @Kiloneie git is the most popular SCM |
16:19:43 | FromDiscord | <Kiloneie> you can lock it down right ? |
16:20:01 | FromDiscord | <Kiloneie> im seeing some extension for vs code... |
16:20:23 | FromDiscord | <haxscramper> You can make a repo with your video series and just associate particular video with a commit |
16:21:04 | FromDiscord | <haxscramper> (edit) "video series" => "code for your videos/" |
16:21:56 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tdd |
16:23:07 | FromDiscord | <InventorMatt> what does a row in the csv file look like? |
16:23:24 | FromDiscord | <Livingstone> [1.23 , 11] |
16:23:34 | * | fredrikhr quit (Quit: Client Disconnecting) |
16:24:29 | * | Gustavo6046 joined #nim |
16:25:57 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tdg |
16:29:31 | FromDiscord | <InventorMatt> that may work |
16:29:32 | FromDiscord | <InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2Tdj |
16:33:16 | FromDiscord | <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:53 | FromDiscord | <Livingstone> So this is the final program but when I echo rmse all I get back is 0.0 |
16:49:56 | FromDiscord | <Livingstone> https://play.nim-lang.org/#ix=2Tdv |
16:50:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tdw |
16:50:30 | FromDiscord | <Yardanico> In reply to @Livingstone "So this is the": Because you don't call your procedures at all? |
16:51:11 | FromDiscord | <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:30 | FromDiscord | <Yardanico> You're not actually calling any of your procedures |
16:51:42 | FromDiscord | <Livingstone> woops hold on |
16:52:32 | FromDiscord | <Yardanico> Also on line 74 "proc" type wouldn't work as you expect it to |
16:52:52 | FromDiscord | <Livingstone> yeah I'm working on that now |
17:07:47 | giaco__ | is it possible to enforce me to handle exceptions? |
17:10:38 | FromDiscord | <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:50 | giaco__ | or is there a shortcut to do "let myvar = unparseablestring.parseInt.ifExceptionDefaultTo(0)" |
17:20:37 | m4r35n357 | OK, 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:31 | m4r35n357 | I have just checked, and it is still happening if I repeat the mistake that exposed it in the first place |
17:22:40 | m4r35n357 | It 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:42 | m4r35n357 | It is obviously more complicated than I can explain, but easy to trigger from a temporary git checkout |
17:27:54 | FromDiscord | <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:36 | FromDiscord | <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:13 | FromDiscord | <Solitude> when pr gets merged, point back at main repo |
17:31:14 | FromDiscord | <no name fits> I guess I'll have to practice that. I don't have a ton of experience forking |
17:31:31 | FromDiscord | <no name fits> Thanks for the input |
17:32:17 | FromDiscord | <clyybber> @no name fits depends on the bindings, some are autogenerated |
17:35:12 | liblq-dev | giaco__: 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:21 | liblq-dev | as for the second question though, not that i know of |
17:35:31 | liblq-dev | though it's quite easy to create a template for that |
17:35:37 | FromDiscord | <no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2TdM |
17:35:59 | FromDiscord | <clyybber> In reply to @no name fits "Well to be specific,": oh yeah nimgl vulkan is a bit incomplete |
17:36:18 | FromDiscord | <clyybber> but its autogenerated |
17:38:12 | FromDiscord | <no name fits> oh |
17:38:25 | FromDiscord | <clyybber> I also have vulkan bindings which I just updated yesterday (now based off nimgl/vulkans generator) |
17:38:37 | liblq-dev | giaco__: https://play.nim-lang.org/#ix=2TdQ |
17:38:54 | FromDiscord | <no name fits> In reply to @Clyybber "I also have vulkan": So what's the approach for that? |
17:38:55 | ForumUpdaterBot | New thread by R3c: Memory increase on simple http server after 50 requests, see https://forum.nim-lang.org/t/7653 |
17:39:21 | FromDiscord | <Solitude> In reply to @no name fits "So what's the approach": switch to clyybbers bindings |
17:39:53 | FromDiscord | <clyybber> I'll upload the generator script once I cleaned it up a bit |
17:40:50 | FromDiscord | <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:05 | FromDiscord | <Solitude> In reply to @no name fits "I'm trying to turn": in this case you would have to fix the generator |
17:41:27 | FromDiscord | <no name fits> So fork the generator? |
17:41:30 | FromDiscord | <clyybber> In reply to @no name fits "So what's the approach": its in nimgl/vulkan/tools |
17:42:45 | FromDiscord | <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:19 | FromDiscord | <clyybber> usually you'd go the c2nim route, which I did before for my wrapper |
17:43:39 | FromDiscord | <clyybber> but that became a bit of a hacky shellscript |
17:45:16 | FromDiscord | <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:51 | m4r35n357 | liblq-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:13 | FromDiscord | <Solitude> vk.xml has protocol description, generator takes that and outputs bindings |
17:47:30 | FromDiscord | <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:59 | liblq-dev | m4r35n357: 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:44 | FromDiscord | <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:03 | giaco__ | 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:46 | FromDiscord | <clyybber> In reply to @Solitude "yeah, i noticed. but": ah I have an option for that in the generator |
17:49:52 | liblq-dev | giaco__: `raises: []` is an annotation you can attach to procs that signifies that they must only raise exceptions from the provided list `[]` |
17:50:08 | liblq-dev | in our case the list is empty, so they must not raise any exceptions in order for the code to compile |
17:50:20 | m4r35n357 | liblq-dev, it is not a simple thing to reproduce without all the code, can you work with a git clone? |
17:53:37 | liblq-dev | yeah |
17:54:11 | giaco__ | 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:08 | liblq-dev | giaco__: i'd ask @Araq about that tbh |
17:55:09 | m4r35n357 | liblq-dev, https://github.com/m4r35n357/ODE-Playground check out branch weirdness |
17:55:19 | liblq-dev | there's most likely some design rationale behind it |
17:55:40 | liblq-dev | and it's probably that listing each and every exception while simultaneously having to handle it is annoying |
17:56:00 | liblq-dev | listing which exceptions you don't want to handle is less annoying though |
17:56:21 | m4r35n357 | liblq-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:26 | giaco__ | 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:51 | m4r35n357 | if you don't have gnuplot you can watch the numbers fly by, but they are doing the right thing |
17:57:46 | m4r35n357 | liblq-dev, so, I contend that, to the uninitiated at least, that code should not even compile. |
17:58:46 | m4r35n357 | liblq-dev, that branch should be easily diff-able to blackhole, the correct code |
18:00:55 | m4r35n357 | liblq-dev, ahem, now pushed! |
18:01:51 | liblq-dev | alright give me a moment |
18:02:04 | m4r35n357 | liblq-dev, so, weirdness=bad, blackhole=good, but they both work |
18:02:06 | liblq-dev | excuse my slow responses, i'm kinda trying to do a million things at once |
18:02:35 | m4r35n357 | liblq-dev, s'OK, I forgot to push until just now ;) |
18:03:02 | m4r35n357 | it is just the movement of a single line from one file to another |
18:03:31 | liblq-dev | alright, so i compiled h_newton |
18:03:38 | liblq-dev | what exactly are you confused about? |
18:04:54 | * | superbia joined #nim |
18:05:23 | m4r35n357 | liblq-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:03 | m4r35n357 | but somehow h() becomes in scope because of the generic parameter |
18:06:17 | m4r35n357 | and I don't understand how, or why this is a good thing |
18:06:25 | liblq-dev | it's a quirk |
18:06:43 | m4r35n357 | but is there any way to avoid it? |
18:06:49 | liblq-dev | i think h is bould lately when your generic proc is instantiated |
18:06:54 | liblq-dev | which h are you trying to call? |
18:07:06 | liblq-dev | (point me to the file) |
18:07:15 | m4r35n357 | the h is in h_newton.nim, the clling code |
18:07:35 | m4r35n357 | if you diff weirdness and blackhole it should stick out |
18:07:59 | liblq-dev | yeah i see it |
18:08:38 | m4r35n357 | the 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:49 | liblq-dev | well it's basically a quirk in how generics work |
18:09:16 | liblq-dev | when you call solve in h_newton.nim the instantiated procedure doesn't exist yet so it goes on to create it |
18:09:37 | liblq-dev | but it appears that it creates the new procedure as if it's declared in h_newton.nim instead of symplectic.nim |
18:10:12 | liblq-dev | if 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:52 | liblq-dev | this will "bind" the symbol from the scope where solve was declared |
18:11:03 | m4r35n357 | liblq-dev, the point is that this is extremely undesirable, I don't want to use h, it is private |
18:11:20 | liblq-dev | well, you can pass it as a parameter to solve |
18:12:01 | m4r35n357 | liblq-dev, but I don't want to |
18:12:15 | liblq-dev | wellโฆ then how would you like to structure your program? |
18:12:36 | m4r35n357 | like in blackhole, it is finished |
18:13:05 | m4r35n357 | I want to do the parameter passing in such a way that I don't leak h() into library code |
18:13:13 | m4r35n357 | even if I make a mistake ;) |
18:13:37 | liblq-dev | well imo passing it as a parameter to solve seems like the sensible option here |
18:14:01 | m4r35n357 | it shouldn't be there, I don't want to pass it in! |
18:14:23 | m4r35n357 | it hsould be called from itself like in blackhole |
18:15:21 | liblq-dev | well alright, then what's the assignment to p.h0 for? |
18:15:27 | liblq-dev | on weirdness |
18:15:27 | m4r35n357 | think 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:10 | m4r35n357 | weirdness is the incorrect code, showing how I made the error that exposed the preblem |
18:16:28 | liblq-dev | it can only leak if you use inexistent procs in your generic proc |
18:16:29 | m4r35n357 | I had to create it just for this! |
18:16:33 | liblq-dev | but i agree it's quite jank |
18:16:52 | liblq-dev | maybe open an issue about this? |
18:16:55 | m4r35n357 | liblq-dev, tghat last thing you said is the bit I am trying to understand |
18:17:24 | m4r35n357 | I need to understand the problem enough to raise an issue, and that is what I am trying to do now |
18:18:08 | m4r35n357 | I still don't really get why this is a desirable effect, what is the use case for it? |
18:18:18 | liblq-dev | m4r35n357 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:33 | liblq-dev | well there are some use cases |
18:18:42 | liblq-dev | but those use cases should require `mixin` imo |
18:19:07 | liblq-dev | one of these use cases is if you want to eg. call `$` on a value whose type is generic |
18:19:15 | liblq-dev | the compiler cannot resolve `$` immediately |
18:19:15 | m4r35n357 | ah now you mentioned that last time, but I read up on mixins and didn't really get them ;) |
18:19:39 | liblq-dev | it 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:21 | m4r35n357 | liblq-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:18 | liblq-dev | the thing is, it is a bad design |
18:22:19 | liblq-dev | i agree with you |
18:22:27 | liblq-dev | it's kind of hard to explain to a beginner though |
18:22:34 | liblq-dev | because of how quirky nim generics are overall |
18:22:54 | m4r35n357 | liblq-dev, but I am struggling to find the right words to put in an issue |
18:24:09 | m4r35n357 | liblq-dev, I have had great success with generics in other areas, so I hope they are not broken |
18:24:34 | liblq-dev | i mean they work |
18:24:53 | liblq-dev | it's just that the language design part is a bit half-baked |
18:26:14 | m4r35n357 | liblq-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:53 | liblq-dev | not one that's stable |
18:27:13 | liblq-dev | you can try concepts but here be dragons https://nim-lang.org/docs/manual_experimental.html#concepts |
18:27:37 | liblq-dev | and araq is working on a concept overhaul so existing code may break soon |
18:28:45 | liblq-dev | and there's like a million reasons not to use concepts, such as concept duplication https://github.com/nim-lang/Nim/issues/13982 |
18:28:59 | liblq-dev | this slows down compilation. a lot. |
18:30:54 | * | oz joined #nim |
18:31:22 | m4r35n357 | liblq-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:51 | liblq-dev | i mean as i said, you can pass your h proc as a parameter to the solve proc |
18:32:02 | liblq-dev | and i feel like that would be the cleanest possible solution |
18:32:09 | liblq-dev | with current mechanisms |
18:32:24 | m4r35n357 | liblq-dev, let's not go there again, I don't _want_ to do that! |
18:32:48 | m4r35n357 | I want it _not_ to be passed as anything |
18:33:03 | liblq-dev | then 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:51 | m4r35n357 | liblq-dev, how many ways can I say that I don't want ti to be visible, injected, passsed or anything else? |
18:34:27 | liblq-dev | none that i know of :/ |
18:35:09 | FromDiscord | <Solitude> doesnt `bind h` should solve this? |
18:35:21 | FromDiscord | <Solitude> i didnt read any of the previous discussion |
18:35:43 | liblq-dev | it won't |
18:35:53 | m4r35n357 | Solitude you are describing another way to leak h. I do not want to leak h. I want to stop h leaking |
18:35:55 | liblq-dev | because if h isn't declared where solve() is then it'll error |
18:36:12 | m4r35n357 | I WANT to see an error!!!!!!! |
18:36:52 | liblq-dev | you will, but it will always error!! |
18:37:00 | liblq-dev | no matter if your code is valid or not! |
18:37:24 | m4r35n357 | liblq-dev, thanks, I am work out now! |
18:37:31 | m4r35n357 | worn out . . |
18:38:02 | liblq-dev | sorry that nim's generic system is so underbaked |
18:38:27 | liblq-dev | hopefully once new concepts get rolled out the situation improves, but for now, we can only hopeโฆ |
18:38:39 | m4r35n357 | liblq-dev, come on, I am trying to understand, not criticise |
18:39:17 | liblq-dev | i mean i'm the critic here aight |
18:39:32 | liblq-dev | i'm trying my best to explain |
18:39:33 | m4r35n357 | I 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:57 | liblq-dev | and i'm sorry to say that but unfortunately i don't really see a solution to your problem |
18:40:03 | m4r35n357 | and you ahve been very helpful |
18:42:19 | m4r35n357 | liblq-dev, so I think I'll just have to ignore it for now. Cheers anyway! |
18:42:35 | liblq-dev | cheers! |
18:44:12 | FromDiscord | <clyybber> huh? that's not a quirk |
18:44:17 | FromDiscord | <clyybber> that's an intentional design |
18:44:34 | FromDiscord | <clyybber> and it makes perfect sense, after all you are calling solve from h_newton.nim ? |
18:44:39 | FromDiscord | <clyybber> where h is in scope |
18:45:45 | m4r35n357 | clybber, yes, but that is none of solve()s business |
18:46:08 | FromDiscord | <clyybber> it is, because generic procs should be able to use locally defined overloads |
18:46:16 | FromDiscord | <clyybber> think about this: |
18:46:36 | FromDiscord | <clyybber> you define a hash for your type |
18:46:40 | FromDiscord | <clyybber> and want to use the table module |
18:46:46 | m4r35n357 | clybber now that what I am trying to understand, |
18:46:47 | FromDiscord | <clyybber> you shouldn't be required to export your hash for that |
18:47:50 | m4r35n357 | OK not a user of the table module or hashes but I think I can follow . . |
18:48:19 | FromDiscord | <clyybber> m4r35n357: If you want the generic to only take a definition from it's declaration scope you want to `bind h` |
18:48:35 | FromDiscord | <clyybber> this should prevent your example from compiling |
18:49:34 | m4r35n357 | clybber 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:56 | FromDiscord | <clyybber> bind h will bind `h` during the declaration of the generic |
18:49:59 | FromDiscord | <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:06 | FromDiscord | <clyybber> \o/ |
18:50:08 | FromDiscord | <fwsgonzo> there was nothing in the changelog |
18:50:12 | m4r35n357 | as long it isn't another way of making h visible to solve . . |
18:50:34 | liblq-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:46 | FromDiscord | <clyybber> it's the only thing that makes sense |
18:51:05 | FromDiscord | <clyybber> liblq-dev: I mean, how else would you do it? |
18:51:19 | liblq-dev | rust can get away without this "only thing that makes sense" by having a functioning trait system ๐ |
18:51:22 | m4r35n357 | clybber so I 'bind h' somewhere in h_newton.nim, and it stops h being visible in solve() ???? |
18:51:32 | FromDiscord | <clyybber> You could of course switch it around and say symbols should be bound at declaration by default and explicitly mixed in |
18:51:51 | liblq-dev | i can already hear you typing because i mentioned rust |
18:52:03 | FromDiscord | <clyybber> me? |
18:52:09 | liblq-dev | somebody |
18:52:11 | m4r35n357 | clybber where precisely would you put the 'bind h' ? |
18:52:24 | FromDiscord | <clyybber> m4r35n357: at the start of the proc body |
18:52:33 | m4r35n357 | whcih proc, h? |
18:52:53 | FromDiscord | <clyybber> no solve |
18:53:10 | m4r35n357 | how can I tell solve not to look at sometinig it can't see? |
18:53:24 | liblq-dev | the 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:27 | m4r35n357 | h is not in scope |
18:53:28 | FromDiscord | <clyybber> by binding the symbols you use |
18:53:36 | liblq-dev | this can be solved by the new concepts |
18:53:42 | FromDiscord | <clyybber> m4r35n357: You are caling h |
18:53:46 | FromDiscord | <clyybber> (edit) "caling" => "calling" |
18:53:52 | m4r35n357 | not from solve() |
18:53:58 | FromDiscord | <clyybber> you are |
18:54:07 | m4r35n357 | no, that is the incorrect code, |
18:54:23 | FromDiscord | <clyybber> there is no way to prevent this "incorrect code" |
18:54:37 | FromDiscord | <clyybber> other than making your function not generic |
18:54:51 | m4r35n357 | clybber that is waht liblq-dev said, and we left ti there |
18:55:21 | FromDiscord | <clyybber> hmm, so you want it for additional error checking? |
18:55:22 | * | Vladar joined #nim |
18:55:28 | m4r35n357 | I can just pretend I never made the mistake, and never saw the problem. |
18:56:12 | FromDiscord | <clyybber> liblq-dev: I don't think the new concepts address that |
18:57:49 | FromDiscord | <TurtleP> sent a code paste, see https://paste.rs/q46 |
18:58:20 | * | waleee-cl joined #nim |
18:59:11 | m4r35n357 | OK 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:47 | FromDiscord | <clyybber> @TurtleP Object construction uses Object(fieldName: value) syntax in nim :) |
19:01:00 | FromDiscord | <clyybber> also hey, are you the turtlep from the love2d 3ds port? |
19:01:10 | FromDiscord | <TurtleP> maaaaybe ๐ |
19:01:14 | FromDiscord | <clyybber> haha awesome |
19:01:36 | FromDiscord | <TurtleP> @clyybber but even besides that point, it seems to not like `get_icon()` |
19:02:11 | FromDiscord | <TurtleP> `attempting to call undeclared routine: 'get_icon'` |
19:02:52 | FromDiscord | <TurtleP> it seems to be acting as though the HAC "class" isn't inheriting anything from Console |
19:03:37 | FromDiscord | <clyybber> hmm, if I correct the object construction and export the fields it compiles fine for me |
19:03:56 | FromDiscord | <TurtleP> export the fields? |
19:04:10 | FromDiscord | <clyybber> yeah, you have to add an asterisk after their name |
19:04:20 | FromDiscord | <clyybber> in the type definition of Console |
19:04:30 | FromDiscord | <TurtleP> I thought it would make it purely public which would be weird |
19:04:48 | FromDiscord | <clyybber> oh yeah it would, I figured you want that since you are constructing HAC in your main.nim |
19:04:54 | FromDiscord | <TurtleP> almost like being able to do `ConsoleObject.app_name = "blah"` |
19:05:10 | FromDiscord | <TurtleP> (but then again nobody is creating a new Console object) |
19:05:14 | FromDiscord | <clyybber> So from what I gather you probably want to define a constructor for HAC |
19:05:29 | FromDiscord | <TurtleP> Console has some common things I need, though which is why I have it |
19:05:40 | FromDiscord | <clyybber> in nim constructors are nothing special so just call it newHAC |
19:06:07 | FromDiscord | <clyybber> @TurtleP you are not importing console in your main are you? |
19:06:11 | FromDiscord | <TurtleP> no |
19:06:25 | FromDiscord | <clyybber> you have to do that to have get_icon be available in main.nim |
19:06:34 | FromDiscord | <clyybber> or alternatively you can export console from hac.nim |
19:07:34 | FromDiscord | <TurtleP> I assume the latter is better practice? |
19:07:54 | FromDiscord | <clyybber> I guess so? I would do the latte |
19:07:55 | FromDiscord | <clyybber> (edit) "latte" => "latter" |
19:08:10 | FromDiscord | <TurtleP> how would I go about this? |
19:08:22 | FromDiscord | <clyybber> just `export console` after your `import console` |
19:09:57 | FromDiscord | <clyybber> liblq-dev: The trait way wouldn't be nimmy IMO, since usually procs aren't bound to a single type. |
19:10:46 | FromDiscord | <clyybber> liblq-dev: IMO a good solution for nim would be a `bindall` statement or something similar |
19:11:20 | FromDiscord | <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:35 | FromDiscord | <Goel> (edit) "problems?" => "problem?" |
19:11:53 | FromDiscord | <clyybber> @Goel Basically you can't have mutual recursion accross objects |
19:11:57 | FromDiscord | <clyybber> (edit) "objects" => "modules" |
19:12:21 | FromDiscord | <clyybber> unless you include them |
19:12:51 | FromDiscord | <zidsal> java has the same issue, maven very much frowns upon circular dependencies |
19:12:52 | FromDiscord | <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:05 | FromDiscord | <zidsal> move the shared logic out to a 3rd module |
19:13:31 | FromDiscord | <clyybber> it's never an issue for me, but other people resort to using include or a seperate module |
19:13:40 | FromDiscord | <TurtleP> @clyybber thanks for the tips! kinda odd having to export console after importing, though |
19:13:44 | Clonkk[m] | <FromDiscord "<clyybber> @Goel Basically you c"> You can partially |
19:14:12 | FromDiscord | <clyybber> with include and forward decls |
19:14:20 | FromDiscord | <clyybber> I can't think of any other way, no? |
19:14:30 | FromDiscord | <TurtleP> that's fair dw |
19:15:13 | FromDiscord | <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:40 | Clonkk[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:29 | FromDiscord | <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:32 | FromDiscord | <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:08 | FromDiscord | <zidsal> what are the actual modules, if you give us a concrete example we can help you ๐ |
19:19:24 | FromDiscord | <clyybber> @zidsal I think it was just a question out of curiosity |
19:19:29 | FromDiscord | <zidsal> ah |
19:20:00 | FromDiscord | <zidsal> pretty sure most major languages that I can think of don't like circular imports |
19:20:09 | FromDiscord | <Goel> Yes, i haven't faced that issues fortunatly, probably that something to worry about with bigger projects |
19:20:25 | FromDiscord | <Goel> (edit) "issues fortunatly," => "issuesfortunatly," |
19:20:32 | FromDiscord | <Goel> (edit) "issuesfortunatly," => "issue fortunatly," |
19:20:52 | FromDiscord | <clyybber> hmm, IME it's not an issue, but different people different structures I suppose |
19:21:01 | FromDiscord | <clyybber> (edit) "IME" => "for me" |
19:25:53 | FromDiscord | <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:26 | FromDiscord | <exelotl> I've never experienced the same problem in C, Java, C# or AS3 |
19:27:45 | FromDiscord | <zidsal> if you treated nim modules like java modules instead of packages you would run into the exact same issue in java |
19:29:52 | liblq-dev | @clyybber but oh the new concepts solve this completely |
19:30:03 | liblq-dev | procs still aren't bound to a single type |
19:30:30 | liblq-dev | concepts just make generic type matching verifiable on a more fundamental level |
19:30:41 | liblq-dev | and allow for better, earlier error handling |
19:30:50 | liblq-dev | with nicer error messages |
19:31:38 | liblq-dev | that's all i'm going for here |
19:31:58 | liblq-dev | concepts shouldn't only serve as a source for documentation, they should also be a hint to the compiler |
19:32:54 | FromDiscord | <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:14 | FromDiscord | <clyybber> @exelotl Hmm, do you include them right now? |
19:33:50 | FromDiscord | <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:45 | FromDiscord | <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:58 | FromDiscord | <clyybber> And then later on include the module regularily |
19:35:05 | FromDiscord | <clyybber> then you can have recursive dependencies |
19:35:19 | FromDiscord | <clyybber> as it's all like one big module where every proc is forward declared sort of |
19:35:46 | FromDiscord | <exelotl> I see, yeah that would work probably |
19:36:31 | FromDiscord | <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:08 | FromDiscord | <clyybber> hehe what are you doing currently to work around the limitation? |
19:38:20 | FromDiscord | <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:39 | FromDiscord | <exelotl> in complex cases I {.exportc.} the proc and {.importc.} it in the other module ๐
|
19:39:56 | FromDiscord | <clyybber> hoho that's a hack :D |
19:40:16 | FromDiscord | <clyybber> but if it works it works |
19:42:50 | FromDiscord | <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:15 | FromDiscord | <clyybber> yeah, it should work fine |
19:44:52 | FromDiscord | <clyybber> liblq-dev: I just checked, they are not addressing this issue |
19:45:14 | liblq-dev | sad |
19:45:39 | FromDiscord | <clyybber> FWIW generics only bind overloaded symbols late by default |
19:46:41 | FromDiscord | <clyybber> but I think the default rules could be adapted a bit to make it more intuitive I suppose |
19:47:44 | FromDiscord | <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:10 | FromDiscord | <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:54 | FromDiscord | <exelotl> So that's a case where I said "fuck it" and used the exportc hack :P |
19:53:42 | FromDiscord | <exelotl> (edit) "whichevery" => "which every" |
19:58:17 | FromDiscord | <clyybber> fair |
20:12:58 | * | narimiran quit (Ping timeout: 256 seconds) |
20:32:40 | * | haxscramper quit (Remote host closed the connection) |
21:02:34 | FromGitter | <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:59 | MIF | hi |
21:19:07 | * | MIF left #nim ("Sturtz Network https://sturtz.cf") |
21:46:47 | * | tane joined #nim |
21:47:32 | FromDiscord | <Hi02Hi> hi ๐ |
21:47:37 | FromDiscord | <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:43 | FromDiscord | <Livingstone> that doesn't do anything |
21:48:19 | FromDiscord | <ElegantBeef> Uncertain what you mean a placeholder |
21:48:35 | FromDiscord | <Livingstone> I have a sequence of (a, b) |
21:48:49 | FromDiscord | <Livingstone> I want to make b unable to do anything |
21:48:52 | FromDiscord | <Livingstone> but not delete it |
21:49:06 | FromDiscord | <ElegantBeef> But data doesnt do anything |
21:49:17 | FromDiscord | <Livingstone> yeah the b element does nothing |
21:49:29 | Prestige | can you share the code? |
21:50:59 | FromDiscord | <Livingstone> line 78 is the place I want to assign a place holder |
21:51:00 | FromDiscord | <Livingstone> https://play.nim-lang.org/#ix=2Tfg |
21:54:18 | Prestige | just remove the last element of the seq? |
21:54:52 | FromDiscord | <Livingstone> no it's got to do with keeping the numbers in the right positions |
21:54:56 | FromDiscord | <Livingstone> I can't remove it |
21:55:14 | FromDiscord | <Livingstone> or rather keeping the size of the sequence correct |
21:55:25 | FromDiscord | <Livingstone> if I remove it then a bunch of calculations get thrown off |
21:55:45 | FromDiscord | <Livingstone> unless you just did it and it worked fine |
22:02:53 | FromDiscord | <Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2Tfm |
22:04:42 | FromDiscord | <Livingstone> result.add was a extra line that should have been deleteed |
22:04:47 | FromDiscord | <Livingstone> I just forgot it |
22:05:53 | FromDiscord | <Hi02Hi> once i removed that line and fixed the proc type, it compiled fine |
22:07:04 | FromDiscord | <Livingstone> you changed the rmse metric proc type? |
22:07:55 | FromDiscord | <Hi02Hi> no, you wanted to `return rmse`, a float, so i changed `evaluate_algorithm` to return a float |
22:10:15 | FromDiscord | <Livingstone> 78, 22) Error: type mismatch: got <seq[seq[float]], BackwardsIndex, int literal(0)>โตbut expected one of: |
22:10:31 | FromDiscord | <Livingstone> template/generic instantiation of `evaluate_algorithm` from here |
22:10:37 | FromDiscord | <Livingstone> the two remaining errors |
22:12:11 | FromDiscord | <Hi02Hi> im pretty sure that `[^1]` is the last element, and `[^0]` isnt |
22:13:16 | FromDiscord | <Livingstone> I assigned row[^1] = 0, so the last element equals zero |
22:13:30 | * | Vladar quit (Quit: Leaving) |
22:14:35 | FromDiscord | <Hi02Hi> i think row is immutable, no?โต`for row in dataset:` would be immutable |
22:15:03 | FromDiscord | <ElegantBeef> yes |
22:16:19 | FromDiscord | <Livingstone> so do I have to assign row to another var and change that? |
22:16:26 | FromDiscord | <Livingstone> and then add that on? |
22:16:34 | FromDiscord | <Solitude> no, iterate with dataset.mitems |
22:18:19 | FromDiscord | <Hi02Hi> `for row in dataset.mitems:` |
22:19:18 | FromDiscord | <Hi02Hi> also, dataset is not passed as a `var seq[seq[float]]` |
22:29:03 | * | superbia quit (Ping timeout: 246 seconds) |
22:29:32 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2Tfp |
22:29:37 | FromDiscord | <Livingstone> this is the error in its entirety |
22:34:08 | FromDiscord | <Hi02Hi> is dataset a var param? |
22:35:19 | FromDiscord | <Livingstone> yes |
22:36:14 | FromDiscord | <Solitude> you are assigning float to sequence of floats |
22:37:25 | FromDiscord | <Yardanico> @dub hi if GT EU what if a float self-identifies as a sequence of floats? |
22:37:46 | FromDiscord | <Solitude> In reply to @Yardanico "<@!104136074569211904> what if a": shoudve declared a converter or gtfo |
22:37:59 | FromDiscord | <Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2Tfr |
22:40:56 | FromDiscord | <fwsgonzo> is it possible to calculate CRC32 checksums at compile time? |
22:41:06 | FromDiscord | <Yardanico> of course |
22:41:12 | FromDiscord | <Yardanico> you can do almost anything at compile-time |
22:41:24 | FromDiscord | <fwsgonzo> cool |
22:41:41 | FromDiscord | <Yardanico> for example compile brainfuck to nim code at compile time |
22:41:55 | FromDiscord | <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:07 | FromDiscord | <Hi02Hi> found this: http://rosettacode.org/wiki/CRC-32#Nim |
22:46:52 | * | PMunch quit (Quit: leaving) |
22:47:27 | FromDiscord | <Livingstone> nim(49) sysFatalโตError: unhandled exception: index 101 not in 0 .. 100 [IndexDefect] |
22:48:32 | FromDiscord | <Hi02Hi> does it show the trace it followed? |
22:50:50 | FromDiscord | <Livingstone> sent a code paste, see https://paste.rs/WUm |
22:51:11 | FromDiscord | <Yardanico> yes because you have wrong code in covariance |
22:51:18 | FromDiscord | <Yardanico> it's ..<x.len not ..x.len |
22:51:33 | FromDiscord | <Livingstone> I changed that already |
22:51:38 | FromDiscord | <Yardanico> anyway, I made your code a bit more idiomatic https://play.nim-lang.org/#ix=2Tfu |
22:51:45 | FromDiscord | <Yardanico> works for me with this https://media.discordapp.net/attachments/371759389889003532/821878497068318730/unknown.png |
22:51:53 | FromDiscord | <Yardanico> if your csv file has a different separator, change it |
22:53:46 | FromDiscord | <Yardanico> works for me just fine |
22:53:53 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/821879036467871744/unknown.png |
22:53:56 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/821879048325169182/unknown.png |
22:54:49 | FromDiscord | <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:19 | FromDiscord | <ElegantBeef> Damn i was too hopeful, nim threads dont work on the pico |
23:08:45 | FromDiscord | <Yardanico> doesn't pico has some RTOS porting to it? |
23:08:51 | FromDiscord | <Yardanico> like FreeRTOS to which we have some support in the stdlib |
23:09:08 | FromDiscord | <ElegantBeef> Not a clue, i'm just porting the stdlib |
23:10:46 | FromDiscord | <ElegantBeef> My knowledge of embedded and C is rather limited |
23:23:47 | FromDiscord | <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:29 | FromDiscord | <Yardanico> @zidsal settings with the same name of course |
23:24:48 | FromDiscord | <Yardanico> if you have gc:arc in global config but define gc:refc in project config, then the latter will be applied |
23:24:57 | FromDiscord | <zidsal> ok that was what I expected, I just wanted to make sure it all inherits nicely |
23:25:19 | FromDiscord | <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:23 | FromDiscord | <Yardanico> like -d:release -d:danger |
23:25:25 | FromDiscord | <Yardanico> -d:lto |
23:25:49 | FromDiscord | <Yardanico> basically anything that is checked against in the default nim config |
23:26:02 | FromDiscord | <zidsal> ah ok |