<< 16-03-2021 >>

00:07:01*jess quit (Quit: K-Lined)
00:07:34*j joined #nim
00:08:24*fredrikhr quit (Quit: Client Disconnecting)
00:09:43FromDiscord<martinium> whats the nim equivalent to python's os.listdir()?
00:11:10*j is now known as jess
00:12:33FromDiscord<Yardanico> https://nim-lang.org/docs/os.html#walkDir.i%2Cstring
00:21:07FromDiscord<martinium> thanks
00:30:54FromDiscord<Yardanico> Question about toOpenArray - does it create a view into the data without a copy?
00:37:46FromDiscord<martinium> can openAsync be used with parsecsv?
00:38:41FromDiscord<ElegantBeef> @Yardanico yes it's a viewSlice
00:39:07FromDiscord<ElegantBeef> It's just a `ptr elem[start]` and a `len`
00:39:41FromDiscord<ElegantBeef> I believe i use it for most of the logic in strviewutils
00:39:50FromDiscord<ElegantBeef> Yep i do
00:41:11FromDiscord<ElegantBeef> I do believe not using the newRuntime causes issues with it, or it just might be arc/orc that's required
00:56:32FromDiscord<Livingstone> I'm importing sugar but I get an error saying undeclared identifier
00:56:56FromDiscord<Livingstone> I also imported it as std/sugar
00:58:33FromDiscord<Yardanico> In reply to @Livingstone "I'm importing sugar but": What Nim version are you on?
00:58:56FromDiscord<Yardanico> And can you show more code? What's the error message?
00:59:09FromDiscord<Livingstone> 1.4.4
00:59:23FromDiscord<Livingstone> rror: undeclared identifier: 'collect'
00:59:39FromDiscord<Livingstone> (edit) "rror:" => "Error:"
01:00:10FromDiscord<Yardanico> can you show how are you using it?
01:00:58FromDiscord<Livingstone> var actual = collect(newSeq):↵ for row in fold:↵ row[^1]
01:01:19FromDiscord<Yardanico> To start off, indentation is wrong
01:01:29FromDiscord<Yardanico> And please show the error from the compiler
01:01:44FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SZP
01:01:53FromDiscord<Yardanico> Are you sure you have the import at top level in your Nim file?
01:02:59FromDiscord<Livingstone> import math, std/random, std/sugar, std/sequtils, std/sets, std/tables↵from std/math import sqrt
01:03:11FromDiscord<Livingstone> is this ok it's how I saw imports written on the nim tutorial site
01:03:26FromDiscord<Yardanico> Yes that's okay but it can be written in a shorter form
01:03:34FromDiscord<Yardanico> Can you show the output of the compiler itself?
01:03:37FromDiscord<Yardanico> Full
01:03:47FromDiscord<Yardanico> When it shows that error
01:04:29FromDiscord<Livingstone> /home/livingstone/Desktop/Linearregression.nim(81, 29) Error: undeclared identifier: 'collect'
01:04:44*nekits071 joined #nim
01:04:58FromDiscord<Livingstone> that's all it gives me
01:05:11*Tanger joined #nim
01:05:20*def-- joined #nim
01:05:36*sepples_ joined #nim
01:05:36*mal`` joined #nim
01:05:40FromDiscord<Yardanico> Do you mind uploading the whole file somewhere? Or just pasting it to e.g. https://play.nim-lang.org
01:06:05*letto_ joined #nim
01:06:06ForumUpdaterBotNew thread by Elcritch: New Nesper release: v0.6.0 includes Nimble build tasks for ESP32 projects! , see https://forum.nim-lang.org/t/7636
01:06:08FromDiscord<Livingstone> how do I share it?
01:06:52FromDiscord<ElegantBeef> Share button bottom left
01:06:56FromDiscord<ElegantBeef> Then copy the url
01:07:11FromDiscord<Livingstone> https://play.nim-lang.org/#ix=2SZQ
01:07:13FromDiscord<Livingstone> I got it
01:07:38FromDiscord<Livingstone> the whole file doesnt fit though
01:07:49*pauwel_k1ak joined #nim
01:07:53*dgb_ joined #nim
01:07:54FromDiscord<Livingstone> I'm stupid
01:09:01FromDiscord<ElegantBeef> Is that error from the compiler or from the editor?
01:09:15FromDiscord<ElegantBeef> If the latter, compile the code and it points directly do a different error
01:09:18*giaco__ joined #nim
01:09:21FromDiscord<ElegantBeef> (edit) "do" => "to"
01:09:43FromDiscord<ElegantBeef> Line 90 in that example has ` for i in 0..(row.len - 1):` and row is an int
01:09:58FromDiscord<ElegantBeef> also worth noting you can do `a ..< b` which will do `a..(b-1)`
01:09:59FromDiscord<Livingstone> compiler
01:11:05FromDiscord<ElegantBeef> This compiles https://play.nim-lang.org/#ix=2SZS
01:11:15FromDiscord<ElegantBeef> There was not a sugar issue
01:11:54FromDiscord<Livingstone> huh weird
01:12:37*pauwel_kwak quit (*.net *.split)
01:12:37*letto quit (*.net *.split)
01:12:37*Jesin quit (*.net *.split)
01:12:48*def- quit (*.net *.split)
01:12:48*giaco_ quit (*.net *.split)
01:12:48*dgb quit (*.net *.split)
01:12:48*sepples quit (*.net *.split)
01:12:48*mal``` quit (*.net *.split)
01:12:48*nekits07 quit (*.net *.split)
01:12:48*def-- is now known as def-
01:12:55*nekits071 is now known as nekits07
01:26:16*Vladar quit (Quit: Leaving)
01:30:13*njoseph_ quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:30:31*njoseph joined #nim
01:31:48FromDiscord<Livingstone> any idea that may be giving me this problem or should I reinstall nim
01:35:03*sagax quit (Ping timeout: 245 seconds)
01:35:19FromDiscord<Yardanico> The only reason I can think of is that you have multiple Nim installations
01:35:43FromDiscord<Yardanico> One latest normal and another one installed through the system's package manager
01:35:59FromDiscord<ElegantBeef> Well `nim -v` should say what ever version is running
01:36:01FromDiscord<Yardanico> With a much older version
01:36:36FromDiscord<Yardanico> In reply to @ElegantBeef "Well `nim -v` should": Well stdlib can still resolve to the older version
01:36:42FromDiscord<ElegantBeef> I suppose
01:36:53FromDiscord<Yardanico> In reply to @ElegantBeef "Well `nim -v` should": But it's worth a try @Livingstone
01:41:19FromDiscord<Livingstone> is this right Nim Compiler Version 1.0.6 [Linux: amd64]?
01:42:13FromDiscord<ElegantBeef> nim stable is 1.4.4
01:42:56FromDiscord<Livingstone> I don't understand
01:43:01FromDiscord<Livingstone> I downloaded 1.4.4
01:43:09FromDiscord<Yardanico> as I said
01:43:25FromDiscord<Yardanico> You probably have it installed through your system's package manager at well
01:43:51FromDiscord<Yardanico> sudo apt remove nim↵if you're on a debian/ubuntu based distro
01:45:00FromDiscord<ElegantBeef> Installing languages through the package manager is just a bad time imo
01:54:19FromDiscord<Livingstone> I'm redoing it now
01:54:22FromDiscord<Livingstone> thanks guys
02:10:25*vicfred joined #nim
02:15:20*abm quit (Read error: Connection reset by peer)
02:36:20*wasted_youth2 quit (Quit: Leaving)
02:51:52*vicfred quit (Quit: Leaving)
02:54:12*gpanders_ quit (Ping timeout: 268 seconds)
03:15:03*Jesin joined #nim
03:19:17*lritter joined #nim
03:24:52FromDiscord<martinium> I am trying to evaluate a regex pattern and if it matches to ignore.
03:25:01FromDiscord<martinium> sent a code paste, see https://play.nim-lang.org/#ix=2T0h
03:25:01FromDiscord<martinium> got an error
03:25:16FromDiscord<martinium> type mismatch regex, bool
03:33:14*rockcavera quit (Remote host closed the connection)
03:33:24FromDiscord<ElegantBeef> Well `re` is a constructor for a regex pattern
03:33:27FromGitter<timotheecour> anyone experiencing unusual CI errors today in the “Install dependencies” stage of several pipelines (linux 32, 64, and OSX) ⏎ (refs https://github.com/timotheecour/Nim/issues/653, https://github.com/timotheecour/Nim/issues/652)
03:33:51FromGitter<timotheecour> and https://github.com/timotheecour/Nim/issues/652)
03:34:26ForumUpdaterBotNew thread by Lotzz: Question about Macros and AST Documentation, see https://forum.nim-lang.org/t/7637
03:35:48FromDiscord<ElegantBeef> Timothee wonder if it's related with bintray apparently getting closed soon
03:36:03FromDiscord<ElegantBeef> Atleast this was linked on the bintray website https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
03:39:14FromGitter<timotheecour> hmm, that’d be ahead of schedule though
03:40:44FromGitter<timotheecour> there are 3 independent failures unrelated to nim affecting nim CI really badly since a few days
03:45:53FromDiscord<ElegantBeef> Yea my experience with CI is forgetting to include the "dont CI" part of the commit message 😄
03:57:09FromDiscord<ajusa> Might be a weird question but is it possible to have more than 256 threads in a thread pool? I feel like I tried this earlier and ran into an issue with creating more threads
03:58:30FromDiscord<treeform> not sure about thread pools, but if you need that many threads you probably want to just manage them directly? I had 50,000 threads running on this computer as a test.
04:08:25FromDiscord<ajusa> Hm, my thought was that the overhead of a thread in a thread pool is smaller? Might not be correct, but I feel like I read that somewhere
04:08:37FromDiscord<ajusa> I'll try using normal threads for now though
04:11:54*spiderstew joined #nim
04:13:27FromGitter<timotheecour> ah it could be caused by bintray outage, it affects both osx and linux (https://status.bintray.com/)
04:13:48FromDiscord<ElegantBeef> Ah so i was close! 😄
04:14:28*spiderstew_ quit (Ping timeout: 260 seconds)
04:14:32FromDiscord<martinium> fixed the regex
04:14:59FromDiscord<martinium> sent a code paste, see https://play.nim-lang.org/#ix=2T0r
04:15:23FromDiscord<martinium> it keeps checking a .exe file in the directory even with that conditional
04:16:14FromDiscord<martinium> (edit) "https://play.nim-lang.org/#ix=2T0r" => "https://play.nim-lang.org/#ix=2T0t"
04:16:16FromDiscord<ElegantBeef> can we see the name?
04:16:30FromDiscord<ElegantBeef> also `if path.endsWith(".csv"):`
04:16:36FromDiscord<martinium> name of the nim file
04:17:56FromDiscord<martinium> hmm may have found the issue
04:19:58FromDiscord<ElegantBeef> @treeform if you want to bench higher throw a `{.push inline.}` got me almost 20ms increase
04:20:17FromDiscord<martinium> fixed
04:20:20FromDiscord<ElegantBeef> In response to that forum post
04:20:27FromDiscord<martinium> had a non-conformant file in folder....
04:20:42FromDiscord<ElegantBeef> `name.cvs.ext`?
04:35:59*vicfred joined #nim
04:45:54FromDiscord<treeform> In reply to @ElegantBeef "<@!107140179025735680> if you want": you pushed it on all functions? I tried inline where it made sense, no real change?
04:46:10FromDiscord<ElegantBeef> I pushed it to everything with the base example and got 10-20ms increase
04:47:31FromDiscord<treeform> thats strange when I do that I get it to 1554.227 ms which is really slow?
04:47:39FromDiscord<treeform> where exactly did you put it?
04:47:44FromDiscord<ElegantBeef> After type defs
04:48:38FromDiscord<ElegantBeef> Did you run without release or danger?
04:48:48FromDiscord<treeform> my bad I ran totally wrong thing
04:48:58FromDiscord<treeform> yeah its 76.718 ms now amazing
04:49:40FromDiscord<ElegantBeef> Yea since we're just concerned about speed inlining everything doesnt matter much
04:52:57FromDiscord<treeform> In my prev experiments in my code base inclining to much makes this slower, probably due to always running cold code...
04:56:15FromDiscord<treeform> In reply to @ElegantBeef "Yea since we're just": Yeah that worked great: https://github.com/treeform/raytracer/commit/2899ea610d3f65c2b4a64aad0a913d4b5cd2a6b9
04:59:45FromDiscord<ElegantBeef> Jeez man you really liked typing! 😛
05:00:22FromDiscord<treeform> it was tactical ctrl-v
05:01:34FromDiscord<treeform> ok now we win on speed but what about lines of code?
05:01:48FromDiscord<treeform> python is the shortest one because it use PIL and does not have to do the image saving?
05:02:12FromDiscord<treeform> if you can use PIL in python could I use pixie and vmath?
05:02:22FromDiscord<treeform> that would make nim code shorter then python?
05:02:49FromDiscord<treeform> because you would get the basic stuff for free/
05:02:51FromDiscord<treeform> (edit) "free/" => "free?"
05:02:56FromDiscord<ElegantBeef> Maybe?
05:03:09FromDiscord<ElegantBeef> Also if you notice they multiline a bunch of the constructors
05:04:37FromDiscord<ElegantBeef> If me make a vector/color constructor we'd save a bunch of lines idiomatically
05:09:13FromDiscord<Livingstone> So I'm parsing a csv file and I'm getting this error unexpected type CSVparser does anyone know what I need to do to correct for this
05:09:13FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=2T0I
05:09:14FromDiscord<treeform> is that allowed?
05:11:13FromDiscord<ElegantBeef> Giving us code helps
05:30:40*Tanger quit (Quit: Leaving)
06:09:13*narimiran joined #nim
06:15:48*icebattle quit (Ping timeout: 260 seconds)
06:16:47FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T0T
06:17:22FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2T0T" => "https://play.nim-lang.org/#ix=2T0U"
06:17:23*icebattle joined #nim
06:17:28FromDiscord<ElegantBeef> train is a `seq[float]` you do `train[0]` which returns the first element, then call `.len`
06:17:30FromDiscord<ElegantBeef> (edit) "train is a `seq[float]` you do `train[0]` which returns the first element, then call `.len` ... " added "on it"
06:17:52FromDiscord<ElegantBeef> floats do not have a procedure or field entitled `len`
06:18:03FromDiscord<Livingstone> oh ok
06:19:26FromDiscord<ElegantBeef> secondly `coef` will not exist in the second loop due to being scoped to the first for loop
06:20:06FromDiscord<ElegantBeef> Thirdly you declare `coef` as a float then index it, which will cause issues after fixing the second issue
06:29:01ForumUpdaterBotNew thread by Halloleo: Retrieve content from a URL under the JS backend, see https://forum.nim-lang.org/t/7638
06:31:40ForumUpdaterBotNew Nimble package! zws - A command line interface for shortening URLs with ZWS instances, see https://github.com/zws-im/cli/blob/main/README.md#zws-imcli
06:33:40*Tanger joined #nim
06:39:02ForumUpdaterBotNew thread by Halloleo: INim is supercalifragilisticexpialidocious!, see https://forum.nim-lang.org/t/7639
06:41:40FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T0Z
06:43:20FromDiscord<Livingstone> (edit) "https://play.nim-lang.org/#ix=2T0Z" => "https://play.nim-lang.org/#ix=2T10"
06:43:38FromDiscord<ElegantBeef> What is `train`?
06:44:24FromDiscord<ElegantBeef> Seems to be a `seq[seq[T]]`
06:44:27FromDiscord<Livingstone> it's a part of a data set with which the algorithm uses to determine a line of regression
06:44:55FromDiscord<ElegantBeef> Use dumber words i'm not too smart
06:45:19FromDiscord<Livingstone> basically I'm teaching the program to think by giving it some numbers
06:45:27FromDiscord<Livingstone> train is the dataset of those numbers
06:45:34FromDiscord<ElegantBeef> Sure, but what's train's type?
06:45:43FromDiscord<Livingstone> in python it's a list
06:45:47FromDiscord<ElegantBeef> Of what
06:45:52FromDiscord<Livingstone> of floats
06:45:53FromDiscord<ElegantBeef> Seems a list of lists
06:46:03FromDiscord<Livingstone> a list of list of floats
06:46:04FromDiscord<Livingstone> yes
06:46:06FromDiscord<ElegantBeef> Ok
06:46:27FromDiscord<Livingstone> so the correct thing would be seq[seq[float]]?
06:46:39FromDiscord<ElegantBeef> Yes
06:47:11FromDiscord<ElegantBeef> So that list comprehension just emits a 0.0 `len(train[0])` times?
06:49:28FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2T12
06:49:49FromDiscord<ElegantBeef> Atleast this is my understanding based off how i think list comprehension works in python
06:53:50FromDiscord<ElegantBeef> So uhhh is that right? 😄
06:58:26FromDiscord<Livingstone> yeah that's right
06:58:32FromDiscord<Livingstone> sorry I was just double checking
07:04:24*krux02 joined #nim
07:10:30FromDiscord<Livingstone> In reply to @ElegantBeef "Yes": does newsequence create an empty sequence with which stuff is filled and also what if I wanted to make a list of something what would I do for that?
07:10:35*krux02 quit (Quit: Leaving)
07:11:30FromDiscord<ElegantBeef> `newSeqWith` takes an integer and a default value
07:11:55FromDiscord<ElegantBeef> Well it's actually a template so it can take any body of code for the right hand
07:12:08FromDiscord<ElegantBeef> What do you mean by "something"
07:12:27FromDiscord<Livingstone> let me just consult my code for a second lol
07:15:18FromDiscord<Livingstone> ok when I mean something say folds is a list can I make I say newlist = newseqwith(folds)
07:15:30FromDiscord<Livingstone> and when I say list I mean sequence
07:15:41FromDiscord<ElegantBeef> Well yea like i said the right hand can be anything
07:15:47FromDiscord<ElegantBeef> Aslong as it's a value
07:15:55FromDiscord<Livingstone> ok cool
07:17:30FromDiscord<ElegantBeef> Like for instance this is completely valid https://play.nim-lang.org/#ix=2T19
07:18:24FromDiscord<ElegantBeef> to note you can use `:` to pass the last parameter to calls
07:18:40PrestigeI hadn't seen newSeqWith, that's pretty neat
07:19:02FromDiscord<ElegantBeef> I mean the real cool stuff is that `:` thing
07:19:14FromDiscord<ElegantBeef> Being able to turn statements into block statements, just super smart
07:19:22PrestigeHell yeah
07:19:29PrestigeI love this language
07:19:45FromDiscord<ElegantBeef> No you dont it doesnt have MI
07:19:45FromDiscord<ElegantBeef> 😛
07:19:54PrestigeHaha well I love it anyway
07:20:02PrestigeMI would be great for game dev though
07:20:09FromDiscord<ElegantBeef> Meh
07:20:14FromDiscord<ElegantBeef> I've never wanted MI
07:20:23FromDiscord<ElegantBeef> Give me runtime interfaces and i'm happy
07:20:51PrestigeThat would be a good step in the right direction too
07:21:01FromDiscord<ElegantBeef> Well we got ifaced now
07:21:22Prestigeifaced?
07:21:24FromDiscord<ElegantBeef> Plus my janky stuff abusing new concepts
07:21:31FromDiscord<ElegantBeef> iface
07:21:34FromDiscord<ElegantBeef> https://github.com/yglukhov/iface
07:22:24PrestigeHm that's interesting
07:22:52narimiranif you want your list to be initialized with 0.0 values, no need for `newSeqWith`, 0.0 is the default for `seq[float]`
07:23:11narimiran@Livingstone, @ElegantBeef ^
07:23:11FromDiscord<ElegantBeef> ^
07:23:15FromDiscord<ElegantBeef> I was going to mention that
07:24:06FromDiscord<Livingstone> well I need to do other lists anyway so good to know either way
07:24:27FromDiscord<ElegantBeef> Yea that's the main reason i mentioned it since i figured it'd come in handy
07:24:34FromDiscord<ElegantBeef> The entire `setutils` module has useful tools
07:24:39FromDiscord<ElegantBeef> (edit) "`setutils`" => "`sequtils`"
07:25:52*waleee-cl quit (Quit: Connection closed for inactivity)
07:31:03*lritter quit (Ping timeout: 246 seconds)
07:32:05FromDiscord<Livingstone> Here is what my program is looking like so far if you're interested in machine learning and yeah I know no comments shame on me but if you read the proc names you should get a general idea
07:32:09FromDiscord<Livingstone> https://play.nim-lang.org/#ix=2T1b
07:33:18narimiranthat is not a valid version
07:33:36narimiranseveral errors spotted in `cross_validation_split`
07:35:14ldleworkNim has enforced exception handling right?
07:35:21FromDiscord<Livingstone> I know it's not it's just where I am at
07:37:04FromDiscord<Yardanico> In reply to @Livingstone "Here is what my": Are you sure that you want to parse a .xls (Excel) file with parsecsv? That's not gonna work
07:37:30FromDiscord<Yardanico> .xls but the question stands
07:37:35FromDiscord<Livingstone> it wasn't my intention but it's just what ended up happening
07:37:48FromDiscord<Yardanico> But you wouldn't be able to
07:38:53FromDiscord<Rika> In reply to @ldlework "Nim has enforced exception": Yes, with the raises pragma I think is what it’s called
07:39:09narimiran@Livingstone i went through the first 50 lines, here are some comments: Livingstone
07:39:15narimiranhere: https://play.nim-lang.org/#ix=2T1d
07:39:41FromDiscord<Livingstone> In reply to @narimiran "<@263060627793248278> i went through": thanks
07:40:05FromDiscord<Yardanico> Lines 54 59 61 are also wrong
07:40:35narimiran@Yardanico yeah, i did 1-50, you do 51-end :D
07:40:48FromDiscord<Yardanico> Also it's sequtils not sequitils
07:41:06narimiranok, i did lines 19-50, you got me there :D
07:41:48FromDiscord<Yardanico> I know that not all have the same approach but @Livingstone have you thought of gradually building up a working program and testing that it works at compiles at all times instead of trying to write the whole program and then fix errors?
07:42:28*lritter joined #nim
07:42:54FromDiscord<ElegantBeef> Oh yard you're here now
07:43:02FromDiscord<ElegantBeef> Left a response to your comment 😄
07:45:52FromDiscord<Livingstone> In reply to @Yardanico "I know that not": That's how I did it at the start and as this is more of a translation than starting from scratch I didn't feel like I needed to I just commented out sections and worked on the individual procedures
07:46:25FromDiscord<ElegantBeef> Also yard... that example apparently works
07:46:25FromDiscord<Yardanico> Fair enough, but you should still check for errors from time to time via the compiler
07:46:34FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2T1g
07:46:38FromDiscord<Livingstone> I do constantly
07:46:39FromDiscord<ElegantBeef> It seems to work
07:47:43FromDiscord<Yardanico> In reply to @ElegantBeef "It seems to work": Well it was reported that it doesn't work with --experimental:strictFuncs which I now think is actually right?
07:48:24FromDiscord<ElegantBeef> They might've had something else wrong
07:49:02FromDiscord<Yardanico> No
07:49:10FromDiscord<Yardanico> With that CLI switch it doesn't work
07:49:22FromDiscord<Yardanico> But AFAIK we want our stdlib to work with that switch or something
07:49:37FromDiscord<ElegantBeef> Ok so this is an issue
07:49:50FromDiscord<ElegantBeef> The CLI switch behaves differently to the pragma
07:50:06FromDiscord<Yardanico> Yeah, see e.g. the
07:50:07FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/16873
07:50:25FromDiscord<ElegantBeef> Oh yea
07:50:35FromDiscord<ElegantBeef> The issue is that when enabling it in the pragma it happens after the json
07:50:39FromDiscord<Yardanico> @ElegantBeef the pragma only applies it to user code I think, but the CLI switch to all of the stdlib as well
07:50:44FromDiscord<ElegantBeef> So it works as is intended but we just have to selectively turn it on/off
07:50:45FromDiscord<Yardanico> Yeah exactly
07:51:22FromDiscord<Yardanico> In reply to @ElegantBeef "So it works as": Wouldn't say "as intended", as from this issue I linked it's preferred to be able to use the CLI switch as well
07:51:46FromDiscord<ElegantBeef> I meant the pragma didnt work differently
07:51:52FromDiscord<ElegantBeef> Just that i used it after the import json
07:52:20FromDiscord<Yardanico> It doesn't matter
07:52:21FromDiscord<ElegantBeef> i can only say introduce a new flag `--strictFuncStdlib` which overrides the strict funcs in the stdlib
07:52:24FromDiscord<Yardanico> Even if you use it before json
07:52:40FromDiscord<Yardanico> as the pragma in your code it won't behave the same as the CLI switch
07:52:49FromDiscord<Yardanico> you can check it yourself
07:52:54FromDiscord<ElegantBeef> Oh i did put it before
07:52:55saem@Yardanico: thanks for the PR! 😄
07:53:09FromDiscord<Yardanico> np :)
07:53:47FromDiscord<ElegantBeef> So we've figured out the actual issue now just need some elegant solution, where is clyybber to give yet another solution 😛
07:54:19FromDiscord<ElegantBeef> Although i think this is desired
07:55:00FromDiscord<Yardanico> we need to annotate the [] proc in JSON with noSideEffect (I mean inside the proc)
07:55:09FromDiscord<Yardanico> Because it doesn't mutate the argument on its own
07:55:25FromDiscord<Yardanico> https://github.com/nim-lang/Nim/commit/48f29972210612b41cb6d98122672b1713edc907 like here
07:55:30FromDiscord<ElegantBeef> as i've said strict func isnt just about "does it mutate"
07:55:43FromDiscord<ElegantBeef> It's does it get a mutable view into the object that was passed as an immutable
07:56:04FromDiscord<Yardanico> but the actual code doesn't get a mutable view
07:56:18FromDiscord<Yardanico> so we need to annotate [] in JSON with noSideEffect inside then
07:57:03FromDiscord<ElegantBeef> Well you can call procedures from funcs no problem
07:57:11FromDiscord<Yardanico> It's not that
07:58:33FromDiscord<Yardanico> Here comes the nesper notification
07:59:18*PMunch joined #nim
07:59:27FromDiscord<ElegantBeef> Doesnt nim automatically create noSideEffect procedures from those that dont mutate global state, atleast i though that's what Araq said after strict funcs were released
07:59:37FromDiscord<Yardanico> In reply to @ElegantBeef "Doesnt nim automatically create": Yes, but check that commit again
07:59:40FromDiscord<Yardanico> To see what I'm talking about
08:00:46FromDiscord<Yardanico> Or https://github.com/nim-lang/Nim/issues/15851 for another example
08:01:19FromDiscord<ElegantBeef> Ah it's like the disabling of thread analysis
08:01:48ForumUpdaterBotNew Nimble package! nesper - Nim wrappers for ESP-IDF (ESP32), see https://github.com/elcritch/nesper
08:02:02FromDiscord<Yardanico> @IDF
08:02:11FromDiscord<Yardanico> @idf35
08:03:25idfwow i have been packaged
08:03:55FromDiscord<ElegantBeef> Wow
08:04:30FromDiscord<ElegantBeef> Are we going to have 2 embedded repos in TMWN 😛
08:05:56FromDiscord<Yardanico> Oh right I forgot about it
08:06:04FromDiscord<Yardanico> I'll also probably add https://github.com/Yardanico/cosmonim
08:06:40FromDiscord<ElegantBeef> Yard maybe add stdlib label to that issue now that we know it's not related to strict funcs other than that they're too strict 😛
08:07:32FromDiscord<ElegantBeef> Cosmopolitan was made for nim their logo is a honey badger
08:07:47saemTried to grok the strict func issue the subtlety is still escaping me.
08:08:26FromDiscord<ElegantBeef> The issue is mainly just that strict funcs is too strict so some things in the stdlib are considered impure and cause a compiler error
08:08:35PMunchHmm, would cosmopolitan with Nim be the perfect malware combination?
08:08:46FromDiscord<ElegantBeef> Things that are known to be non mutating can be annotated with `{.noSideEffect.}`
08:08:50FromDiscord<ElegantBeef> Hello pmunch
08:08:56PMunchHi
08:09:10FromDiscord<Rika> No it won’t
08:09:11FromDiscord<ElegantBeef> Have you seen my Pico stuff, it's all your fault, showing off your keyboard stuff 😛
08:09:23PMunchOoh, no I haven't
08:09:29FromDiscord<Rika> Cosmo only allows for POSIX api even on windows I believe...
08:09:30saemI wonder if the effect analysis is incorrect?
08:09:38FromDiscord<Yardanico> @PMunch not really, the binaries are much more unusual and it's harder to use OS specific API
08:09:48FromDiscord<Yardanico> @Rika you can use OS APIs
08:09:50FromDiscord<ElegantBeef> https://github.com/beef331/picotemplate
08:09:52PMunchI'm redoing my bathroom, so most of my attention is on that at the moment..
08:09:56FromDiscord<Yardanico> E.g win32
08:10:09FromDiscord<ElegantBeef> Ah explains why you've been non existent here
08:10:35FromDiscord<ElegantBeef> Examples exist in that repo, and i've got the stdlib over here https://github.com/beef331/picostdlib
08:10:51FromDiscord<ElegantBeef> Though i havent got tiny usb to compile yet
08:10:51saemI was wondering were PMunch was, as well.
08:10:56PMunch@Yardanico, unusual binaries might not be a bad thing for malware. But I guess unless you really want to target the small percentage of Linux/Mac users then it would be better to just write Windows specific stuff
08:10:59FromDiscord<whisperdev> What is the fastest regex engine for Nim?
08:11:01FromDiscord<ElegantBeef> Nor do i know if resus works 😄
08:11:09*gpanders joined #nim
08:11:14FromDiscord<Yardanico> @whisperdev the default one I guess - re?
08:11:19FromDiscord<Yardanico> PCRE is quite fast
08:11:24PMunch@ElegantBeef, I mean I was logged on for like 8 hours yesterday, so not exactly gone :P
08:11:27FromDiscord<Yardanico> There's nim-regex that's pure Nim but it's slower
08:11:33PMunchJust not as much in the afternoon
08:11:39FromDiscord<ElegantBeef> You logged in during my sleep time then
08:11:44FromDiscord<ElegantBeef> So that's like gone
08:11:45PMunchBut its good to know that you miss me when I'm gone :)
08:11:48FromDiscord<whisperdev> I have decided to use nim-regex because it's easier to ship my program
08:11:58FromDiscord<Yardanico> yeah that's the main thing with it
08:12:05FromDiscord<Yardanico> It's much nicer to have a pure Nim package
08:12:10PMunchI should really get a Pico
08:12:25FromDiscord<ElegantBeef> Certainly since i need someone else to help debug this shite 😄
08:12:27FromDiscord<Yardanico> So if the majority of your runtime isn't related to regexes then nim-regex will do fine
08:12:34PrestigePMunch: pi pico?
08:12:35FromDiscord<Yardanico> For some things you can also use npeg
08:12:42FromDiscord<ElegantBeef> Yes
08:12:46PMunch@Prestige, yeah
08:12:57FromDiscord<ElegantBeef> Prestige is apparently disregarding my links
08:12:59PMunchThat's the thing @Elegant has wrapped :)
08:13:06PrestigeI just glanced at chat :P
08:13:08FromDiscord<Yardanico> Does anyone know if zevv abandoned Nim?
08:13:19PMunchMore or less
08:13:24PMunchHe's doing Elixir now
08:13:34PMunchWith disruptek
08:13:41FromDiscord<Yardanico> That's sad
08:13:43PMunchI don't think he's entirely gone though
08:13:47FromDiscord<Yardanico> npeg :)
08:13:57*fredrikhr joined #nim
08:14:18PMunchYeah npeg is too good to go, if anything I'll take over maintaining it myself!
08:14:52FromDiscord<ElegantBeef> Honestly though i'm surprised how little work it took to get the pico to run nim
08:15:08FromDiscord<Yardanico> that's what you get with the C backend :)
08:15:21FromDiscord<ElegantBeef> Yep something that doesnt even know it's digesting Nim
08:15:25PMunchBut I don't think he's completely gone, but the recent conflicts have unfortunately driven quite a few of the old-school Nim people off :(
08:16:13PMunch@ElegantBeef, yeah it's pretty neat. The teensy and arduino stuff I've been doing has been surprisingly easy once you've got the basics set up.
08:16:46PMunchAnd once you have it set up it's pretty much the same as just writing normal Nim, which is really cool
08:16:59FromDiscord<ElegantBeef> The most annoying part is the use of preprocessors and trying to process what it actually is
08:17:15PMunchWhat do you mean?
08:17:26FromDiscord<ElegantBeef> One second
08:17:38FromDiscord<whisperdev> How do I get all the captures with nre?
08:17:46FromDiscord<ElegantBeef> https://github.com/raspberrypi/tinyusb/blob/e0aa405d19e35dbf58cf502b8106455c1a3c2a5c/src/class/hid/hid_device.h#L170-L258
08:17:53FromDiscord<whisperdev> Say I have a multiline output and I want to get all the matches from that.
08:17:57PMunchOh by the way, we should really set up some kind of list of nim.cfg files for different platforms
08:18:00FromDiscord<ElegantBeef> I was trying to get tiny usb to work, seen that and went "Nope"
08:18:24FromDiscord<ElegantBeef> What do you mean?
08:18:44saemI too am interested in knowing that
08:18:45PMunchOh wow, those are terrible
08:19:00PMunchWould be much nicer as a Nim template ;)
08:19:09PMunchWhat I meant by the nim.cfg thing?
08:19:14FromDiscord<ElegantBeef> Yea
08:19:14saemYeah
08:19:30FromDiscord<ElegantBeef> i'm just using `--os:standalone --cpu:arm`
08:19:45FromDiscord<ElegantBeef> Still using cmake here
08:19:52FromDiscord<Yardanico> not even os:any + arc?!
08:19:54PMunchAh, I guess it's more of an issue with AVR and uch
08:19:55FromDiscord<Yardanico> Blasphemy
08:20:00FromDiscord<Yardanico> Burn at stake
08:20:06PMunchThis is what I use for the Teensy 2.0: http://ix.io/2T1m
08:20:10FromDiscord<ElegantBeef> I couldnt get `os:any` to compile iirc
08:20:20saemAm with Yardanico on this one.
08:20:29PMunchYeah I also had some trouble with os:any
08:20:30FromDiscord<ElegantBeef> I'm using arc
08:20:41FromDiscord<Yardanico> In reply to @ElegantBeef "I couldnt get `os:any`": What was the error?
08:20:53FromDiscord<ElegantBeef> Let me get it for you
08:21:06FromDiscord<ElegantBeef> I take it back it didnt error
08:21:29FromDiscord<ElegantBeef> Though i do have to use malloc
08:21:41FromDiscord<Yardanico> -d:useMalloc
08:21:59FromDiscord<ElegantBeef> How else would i know i needed to?
08:22:00FromDiscord<ElegantBeef> 😄
08:22:02PMunchHmm, now I switched to os:any and it works just fine..
08:22:08FromDiscord<Yardanico> Xd
08:22:21FromDiscord<ElegantBeef> Yea must've just been early step issues i conflated to os:any
08:22:30PMunchAh, I have also added -d:useMalloc it seems
08:22:49FromDiscord<ElegantBeef> Without malloc you get told to port the memory manage
08:22:50FromDiscord<ElegantBeef> (edit) "manage" => "manager"
08:23:07FromDiscord<ElegantBeef> So that's probably the reason i swapped to standalone since it got further without malloc
08:23:08PMunchWhat's the difference between standalone or any by the way?
08:23:21FromDiscord<ElegantBeef> But then i hit the ram limit with standalone + nim's allocator
08:23:56FromDiscord<ElegantBeef> Also pmunch i am using templates to ensure people cannot fuck up proc definitions for these weakly bounded functions they have
08:24:03PMunchI get this error with standalone and no useMalloc: error: size of array 'tyArray__2k7c2ydq7o33Y9aVO5jv8Xw' is too large
08:24:05FromDiscord<Yardanico> @PMunch any is less limited
08:24:21FromDiscord<ElegantBeef> Might resolve some of my issues i had then
08:24:25PMunch@ElegantBeef, what do you mean?
08:24:38saemBTW, anyone tackle having multiple versions of the same module in one project especially for various transitive dependencies?
08:24:44FromDiscord<ElegantBeef> So the tinyusb implementation uses weakly binded functions for callbacks
08:24:54FromDiscord<ElegantBeef> https://github.com/beef331/picostdlib/blob/master/src/picostdlib/tusb.nim#L169
08:25:07FromDiscord<ElegantBeef> I've got these templates to ensure users do not have to spell the C name properly one bit
08:25:57FromDiscord<ElegantBeef> I probably have to add `noConv` or similar to be super safe here
08:26:20FromDiscord<ElegantBeef> But yea `attribute ((weak))` is weird
08:26:24FromDiscord<Yardanico> For callbacks you usually cdecl no?
08:26:30FromDiscord<Yardanico> C callbacks
08:26:31PMunchOooh, so you just have to name them something specific?
08:26:35FromDiscord<ElegantBeef> Yep
08:27:03PMunchYour way is much better
08:27:30PMunchBut maybe a pragma macro would be better?
08:27:46FromDiscord<ElegantBeef> Idk, this was quicker
08:27:53PMunchOh for sure
08:28:16FromDiscord<ElegantBeef> I was just after "Can i get it to actually become a usb device, and the answer was a resounding "Fuck no you dont know C"
08:28:37PMunchHaha :P
08:28:55PMunchThat's why I use the tiny USB library thing for my keyboard at the moment
08:29:05PMunchI want to change that at some point though
08:29:42FromDiscord<ElegantBeef> Get a pico and swap to it for your driver so we can push Nim onto it 😛
08:30:19FromDiscord<ElegantBeef> It's dual core dude, that means you can emulate a commedore 64 and have a keyboard all in a single small board
08:30:38saemLife goals
08:31:45PMunchHaha
08:33:11FromDiscord<ElegantBeef> Also are you wrapping libraries like me? Grab an example implement all the functions it calls, run the example and hope it shares the same output?
08:33:31PMunchI mean my goal is to have my keyboard only running over i2c, so I can swap out the controller willy-nilly
08:34:00PMunchYeah that sound about right for what I do
08:34:02FromDiscord<ElegantBeef> It's even worse when something like `hello_resus` it's supposed to print to the usb debugger, but i dont see anything on the C example nor my Nim one
08:34:22PMunchThen you haven't connected your USB debugger correctly :P
08:34:23FromDiscord<ElegantBeef> I dont know if it works with usb debugging or i messed up
08:34:32FromDiscord<ElegantBeef> It's how i'm powering it
08:35:13PMunchHuh, kinda weird that it is MicroUSB and not USBC
08:36:00PMunchUgh, shipping is more expensive than the chip..
08:36:46FromDiscord<whisperdev> Say I have a multiline output and I want to get all the matches from that.How do I do that?
08:38:35FromDiscord<Solitude> https://nim-lang.org/docs/nre.html#findAll%2Cstring%2CRegex%2Cint
08:38:40PMunchI mean an article like "How to get more out of your Pi Pico with Nim" could be great for publicity
08:39:14PMunchComparing Nim to MicroPython and showing how you can do things just as easily with a much smaller footprint
08:39:26FromDiscord<ElegantBeef> And static typing
08:39:37FromDiscord<ElegantBeef> And faster
08:39:43PMunchYeah
08:40:43PMunchCheapest I can find the Pico with shipping and import taxes is 11.5 CAD
08:41:23FromDiscord<ElegantBeef> Yea my order was like 24CAD and half of that was shipping
08:41:39PMunchFor one Pico?
08:41:41FromDiscord<ElegantBeef> Got a bread board, headers and the pico
08:41:46PMunchAh right
08:41:53PrestigeIdk what I'd do with one of those tbh
08:42:05FromDiscord<ElegantBeef> Help me port the stdlib 😉
08:42:51FromDiscord<ElegantBeef> The big thing for me is that can be a usb device
08:43:11FromDiscord<ElegantBeef> The cheapest before that i knew of was the teensy and those are like 4/5 times the price
08:43:48PMunchYeah, that alone makes it super interesting for keyboard dev
08:43:58PMunchI mean it's way overpowered for it, but still
08:46:37FromDiscord<ElegantBeef> The one annoying thing i've found is that they're trolly with the pin layouts
08:46:59FromDiscord<ElegantBeef> 2 gpio, 1 ground, 4 gpio, 1 ground, 4 gpio,
08:47:36FromDiscord<ElegantBeef> So you have fun finding the square solder points
08:48:53PMunchHaha, yeah for some reason they tend to do that..
08:49:23PMunchThe best is stuff like the Teensy where the labels don't correspond to the names they have given them in Arduino
08:49:50PMunchNot a big issue when connecting directly as I do with Nim, but still
08:50:11FromDiscord<ElegantBeef> Yea for me i just throw an image on my screen of the bottom of the board which has silk screen on it
08:50:39FromDiscord<ElegantBeef> yes due to how this board is flashed, you have a top side which you need to see
08:51:14FromDiscord<ElegantBeef> plug it in whilst holding the bootsel button to enter flash mode which then the mass storage device appears and you can drop the uf2 onto
08:51:44PMunchOh right, it had that weird system
08:51:58FromDiscord<ElegantBeef> One detractor is yea you have to hit a button to flash it
08:52:29PMunchThat's the same with the Teensy
08:52:38PMunchBut I think there is a way to trigger it
08:53:20FromDiscord<ElegantBeef> They also seem very suggestive that you should use a second pico to debug it over serial uart
08:56:48FromDiscord<Yardanico> and you should get the 3rd one in case one of the first two breaks :)
09:00:59*Tanger quit (Remote host closed the connection)
09:12:14*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
09:12:28FromDiscord<KnorrFG> i remember reading that there were certain groups of types, ie number, which contains all ints and floats, etc, that u could use to restrict generic params, but i dont remember the name any more, what was it?
09:12:39FromDiscord<ElegantBeef> `SomeNumber`
09:12:58FromDiscord<KnorrFG> and what was the name of that concept, so i can look up the other groups?
09:12:59FromDiscord<ElegantBeef> The generic groups start here https://nim-lang.org/docs/system.html#SomeSignedInt
09:13:06FromDiscord<KnorrFG> ah, ty
09:13:10FromDiscord<ElegantBeef> They're just typeclasses
09:13:57PMunchDamn {.push inline.}, aggressive move there @Elegant: https://github.com/treeform/raytracer/blob/master/nim/story.md
09:14:55FromDiscord<ElegantBeef> Why we're after speed
09:15:22FromDiscord<ElegantBeef> Procedure calls take time, if you remove all of them you've got a massive binary but speeed
09:15:30PMunchI like how he went from "faster than C. Great! Job done." at 164ms average and then just threw in a couple more simple things and dropped down to 80ms average :P
09:15:43PMunchFaster than C? Eh, lets just say twice as fast!
09:15:58FromDiscord<ElegantBeef> To be fair the C version doesnt agressively inline
09:15:59PMunchI mean yeah..
09:16:11*Lord_Nightmare joined #nim
09:16:20PMunchWould be interesting to see the binary sizes
09:16:23FromDiscord<ElegantBeef> But we went from being super slow to being respectable
09:16:38PMunchI mean it went 10x from just -d:release..
09:16:43FromDiscord<ElegantBeef> A lot of that was just not making something heavily iterative in danger
09:16:47FromDiscord<ElegantBeef> (edit) "danger" => "debug"
09:18:02PMunchI'm leaning towards adding a compilation hint that says "This is a debug version, for speed and benchmarking, please enable -d:release or -d:danger"
09:18:24FromDiscord<ElegantBeef> Well the one file had the release
09:18:29FromDiscord<ElegantBeef> it was just the .bat that didnt
09:20:39FromDiscord<ElegantBeef> But that was a fun repo and treeform got a nice story
09:21:02*xet7 joined #nim
09:24:52PMunchHmm, did you even try {.noinit.} on the ObjectIntersect?
09:25:51FromDiscord<ElegantBeef> I didnt try much
09:26:37FromDiscord<ElegantBeef> I looked at it went "Eh this is too much for me to analyze, through inline on it and called it a day"
09:26:43FromDiscord<ElegantBeef> (edit) "through" => "threw"
09:27:44FromDiscord<ElegantBeef> I'm terrible with quotes tonight
09:29:26FromDiscord<enthus1ast> Do you know if there's is a matrix chat protocol sdk/client for nim? I've started to work on o e and was looking for a wrapped Libolm and there is one. So I wonder if I missed the nim matrix library.
09:29:46PMunchDamn just tried --gc:arc without changing the code (and adding -d:danger), dropped from 157ms to 100ms
09:30:17*Nuc1eoN joined #nim
09:30:59PMunchEh, noinit didn't seem to do much. I guess mratsim fixed the bug where it wouldn't properly detect if it was needed or not
09:32:15Oddmongeris there a gui lib working with bare sdl2 ? I mean, nothing to install , except sdl2 (i use Vladar version) and the gui lib
09:32:23FromDiscord<ElegantBeef> Oh i think i just found easy perf increase
09:32:39FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=2T1H
09:35:12*vicfred quit (Quit: Leaving)
09:37:15FromDiscord<ElegantBeef> Ah nvm i'm dumb
09:37:33FromDiscord<ElegantBeef> I dont think Nim really has an equivalent
09:37:38PMunchHuh, with {.push inline.} it only grew from 36K to 39K
09:38:00PMunchBut only dropped from 88 to 80ms for me
09:38:08euantoranoAnother case of showing how great the Nim stdlib is: https://benhoyt.com/writings/count-words/#performance-results-and-learnings :) In simple tasks like this, Nim makes life too easy
09:38:14FromDiscord<ElegantBeef> Look at me with my super fancy schmancy cpu!
09:38:30PMunchHuh?
09:38:40FromDiscord<ElegantBeef> I get 94ms
09:39:15PMunchNot sure if my i7-4770k is considered fancy nowadays
09:39:25PMunchIt's not even overclocked :P
09:39:25FromDiscord<ElegantBeef> Ah shit we're in the same punching class
09:39:46FromDiscord<ElegantBeef> I have a xeon1231v3 which is basically your cpu without an igpu and slightly underclocked
09:40:42FromDiscord<ElegantBeef> Yea i really like having a stdlib full of usefull stuff
09:41:03FromDiscord<ElegantBeef> If you dont scroll through the stdlib every so often and go "Oh cool this exists" are you really a nim programmer?
09:41:23FromDiscord<ElegantBeef> ~~Especially with 1.6 when enum/setutils get stable~~
09:41:32FromDiscord<Rika> In reply to @euantorano "Another case of showing": Nothing in the conclusion about Nim though
09:41:36PMunchYou don't know the stdlib by heart?
09:41:47FromDiscord<ElegantBeef> I havent been here as long as you sorry
09:41:51FromDiscord<ElegantBeef> I'll try harder next time
09:42:02PMunchHaha, just kidding :P
09:42:11PMunchI know the parts I use often pretty well though
09:42:25euantoranoRika: Yeah, the post was written before we contributed a Nim version and seems they only update the list of versions and table of results
09:42:30PMunchAnd wait, what's changing in enum/setutils?
09:42:37FromDiscord<ElegantBeef> We're getting them 😄
09:43:17FromDiscord<Rika> What’s in it
09:43:29FromDiscord<ElegantBeef> Setutils having `yourSet[value] = true` and `yourSet.complement` which inverts the set(even holey enum ones)
09:44:09FromDiscord<ElegantBeef> https://nim-lang.github.io/Nim/setutils.html
09:44:19FromDiscord<ElegantBeef> Oh also toSet
09:44:28FromDiscord<ElegantBeef> Forgot that was the intial starter
09:45:26FromDiscord<Yardanico> https://github.com/nim-lang/Nim/pull/16067
09:45:28FromDiscord<ElegantBeef> Fullset is a holey enum safe version of `{A..Z}` where it only includes actual values
09:45:33FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/821318253082443786/unknown.png
09:46:12FromDiscord<Yardanico> works with nim check too
09:46:16FromDiscord<ElegantBeef> Nice
09:46:40FromDiscord<ElegantBeef> But 1.6 is having a bunch of goodies or atleast prospect of goodies
09:46:58FromDiscord<ElegantBeef> Might finally get that `iteratable[T]` so we dont need to do `toSeq(table.values)`
09:48:23saemI have some misgivings a about that one, maybe I should take type witnesses or at least give trying to understand them another go.
09:48:47FromDiscord<ElegantBeef> Not a clue
09:48:58FromDiscord<ElegantBeef> I like the premise of it since it makes less ergonomic issues
09:49:23FromDiscord<ElegantBeef> Looking at the forum posts about "Why does thing.iterator.toSeq fail to compile"
09:49:49saemThe goal is a good one, but the way it's achieved, I'm less certain.
09:50:09saemI read it
09:50:34PMunchLooks like an interesting release indeed
09:50:58FromDiscord<ElegantBeef> Yea, i'm going to bed now
09:51:02FromDiscord<ElegantBeef> Buh bye
09:51:09saemThere is another couple posts that end in someone (can't recall the name) describing how the initial attempt was very close.
09:51:19saemI should give sleeping another go too
09:53:04FromDiscord<Rika> In reply to @ElegantBeef "Might finally get that": Iterable?
09:55:11*sz0 quit (Quit: Connection closed for inactivity)
09:57:21FromDiscord<Yardanico> @Rika https://github.com/nim-lang/Nim/pull/17196
09:59:15FromDiscord<Rika> Why lowercase
09:59:29FromDiscord<Rika> Other type classes aren’t lowercase
09:59:53FromDiscord<Rika> Eh okay
10:02:49FromDiscord<Yardanico> @Rika don't ask me :P
10:03:02*Jjp137 quit (Ping timeout: 264 seconds)
10:03:59*tane joined #nim
10:15:38FromDiscord<Yardanico> would it make sense to add "assert a.len > 0" to `sample` procs in random?
10:15:53FromDiscord<Yardanico> like https://github.com/nim-lang/Nim/pull/17031 but for `sample` so that the assert comes from the sample proc and not from rand
10:16:53FromDiscord<Yardanico> right now it's Error: unhandled exception: /home/dian/Things/Nim/lib/pure/random.nim(312, 10) `x.a <= x.b` [AssertionDefect]
10:31:32ForumUpdaterBotNew thread by Drkameleon: Compiling Nim project for arm/arm64, see https://forum.nim-lang.org/t/7641
10:42:49FromDiscord<XxDiCaprioxX> Hi, can someone recommend me a package for opening a file dialog?
10:42:51FromDiscord<clyybber> @Yardanico hmm, I think this way is better for now, because it's not immediately clear that 1..0 should have a negative len
10:43:26FromDiscord<Yardanico> @clyybber well I meant that if an empty array/seq is passed to `sample` an nicer assert would be shown
10:43:52FromDiscord<clyybber> ah, yeah
10:44:10FromDiscord<clyybber> sure, makes sense
10:44:29FromDiscord<clyybber> oh haha @Yardanico my bad, I misread
10:46:18m4r35n357Hi Guys, trying to define a function variable, I am using "var u_p: proc(p: Parameters, cd: float) = update_p_auto" where update_p_auto is a concrete function, but got error: Error: type mismatch: got 'proc (p: var Parameters, d: float){.noSideEffect, gcsafe, locks: 0.}' for 'update_p_auto' but expected 'proc (p: Parameters, cd: float){.closure.}'. What am I doing wrong?
10:47:16FromDiscord<clyybber> your update_p_auto has a var param
10:49:13m4r35n357clyybber great catch!
10:49:46m4r35n357I always get sidetracked by the curly braces and miss the obvious stuff!
10:49:52FromDiscord<clyybber> hehe :D
10:52:50FromDiscord<Araq> offtopic, but too interesting: https://www.electronicdesign.com/markets/automotive/article/21121197/ada-and-riscv-secure-nvidias-future
11:00:49*idf quit (Ping timeout: 276 seconds)
11:08:22FromDiscord<clyybber> neat!
11:08:54Clonkk[m]Is it possible to specialize generic proc ? ``proc x[I: static[int]]() = echo "generic"; proc x[I: static[0]]() = echo "specialized" ``
11:09:29liblq-devno, but you can use a when statement inside of the proc
11:09:35*Vladar joined #nim
11:10:00*liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/RFGqkWZWIVBINuVCweglRxpE/message.txt >
11:10:35FromDiscord<mario2> Is it possible to highly optimize nim for embedded programming? Like have nim make C or C++ code that uses as little memory as possible?
11:10:43liblq-dev@mario2 yes
11:10:58liblq-devyou can disable the GC completely, or better yet, use ARC
11:11:00FromDiscord<mario2> How then?
11:11:06FromDiscord<mario2> Thanks
11:11:17FromDiscord<mario2> Anything else to squeeze out performance?
11:11:30liblq-devwell not really
11:11:36liblq-devother than this nim is as fast as C
11:11:48FromDiscord<mario2> What about using nim style pointers?
11:11:56liblq-devyou can also avoid seqs, strings, refs
11:11:59Clonkk[m]<liblq-dev "no, but you can use a when state"> Yes, but then you can't adapt a potential protoype. What I had in mind was something like this :
11:12:13Clonkk[m]Probably not possible then :)
11:12:23liblq-devClonkk: yeah that's not possible
11:12:39liblq-devor maybe 🤔
11:12:56FromDiscord<mario2> What about using nim style pointers? Would that be able to further optimize nim to use less memory and less computing power?
11:13:07Clonkk[m]<FromDiscord "<mario2> What about using nim st"> Nim pointers are identical to C pointers
11:13:10liblq-devwdym nim style pointers?
11:13:41Clonkk[m]<liblq-dev "or maybe 🤔"> Don't give me hope ^^
11:13:51FromDiscord<mario2> According to rosetta code: "There are two types of pointers in Nim. Safe, garbage-collected references and unsafe pointers. "
11:13:52Clonkk[m]I'll spend my day on it if there's a possibility :D
11:14:14FromDiscord<Rika> You mean “ref” versus “ptr”
11:14:15Clonkk[m]<FromDiscord "<mario2> According to rosetta co"> pointers are pointers. reference are garbage collected heap allocated value.
11:14:16FromDiscord<Rika> ?
11:14:17FromDiscord<clyybber> In reply to @Clonkk "<liblq-dev "no, but you": @Yardanico huh, it seems to have ate this
11:14:30FromDiscord<Yardanico> no
11:14:32FromDiscord<mario2> So don't use refs?
11:14:32FromDiscord<Yardanico> thats matrix
11:14:48FromDiscord<Yardanico> @clyybber https://media.discordapp.net/attachments/371759389889003532/821340716994527282/unknown.png
11:14:53FromDiscord<Yardanico> it's the same as discord->irc replies work
11:14:59FromDiscord<Yardanico> i don't embed the full context, so does the matrix bridge
11:15:05Clonkk[m]<FromDiscord "<clyybber> In reply to @Clonkk ""> Multiline message do not get handled too well from Matrix to discord from what I gather
11:15:29FromDiscord<clyybber> Ah ok
11:15:40FromDiscord<clyybber> thought we handled matrix -> discord directly
11:15:46*haxscramper joined #nim
11:15:47FromDiscord<Yardanico> we do on two channels with t2bot.io
11:15:53FromDiscord<mario2> Is there any time I should be using unsafe pointers?
11:15:57FromDiscord<Yardanico> FFI
11:15:59liblq-devClonkk: nah that doesn't seem possible after all
11:16:04FromDiscord<Yardanico> low-level OS APIs
11:16:08liblq-devi was hoping you could create a compileTime proc that returns a type
11:16:11liblq-devbut nada
11:16:16FromDiscord<Yardanico> fuck me
11:16:18Clonkk[m]Sad
11:16:21FromDiscord<Yardanico> "hoping you"
11:16:22FromDiscord<Yardanico> ho PING
11:16:23Clonkk[m]Thanks anyway
11:16:24FromDiscord<Yardanico> AAAAAAAAAAAAAAAAAAAAAAAAAA
11:16:59liblq-devho @Yardanico
11:17:08liblq-devhahahaha comedy
11:17:15FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/821341333783969812/unknown.png
11:17:18FromDiscord<Yardanico> this is what I'm talking about
11:17:22liblq-devlmaooooooo
11:17:33liblq-devthat's effective suicide
11:17:40liblq-devcalling yourself "you"
11:17:45liblq-devpinged them again, noice
11:17:47FromDiscord<Rika> Guess you don’t check if there’s a space before ping
11:17:51FromDiscord<mario2> Let me ask you. If I'm making a large program and want to use as little memory as possible, can I still compile it for an embedded program even though it's on a modern system?
11:17:51FromDiscord<Rika> You didn’t
11:17:52FromDiscord<Yardanico> @liblq-dev no you didn't
11:17:56FromDiscord<Yardanico> it's the "hoping"
11:18:00FromDiscord<Yardanico> I have a match for "ping X"
11:18:02liblq-devfrick
11:18:03FromDiscord<Yardanico> "hoping X" matches that
11:18:05liblq-devXDDD
11:18:09PMunch@mario2, there are a couple ways Nim can outperform C on embedded devices. Or rather outperform the C that you would typically write. And this is meta-programming. You can create patterns that look nice but boil down to super optimised things, or write procedures to pre-calculate values and such. So your Nim code would be nice and readable, but end up as very optimised C code.
11:18:50PMunch@mario2, that last question didn't make much sense
11:19:11PMunchYou won't use less memory emulating an embedded device on a modern system than running your program natively..
11:19:16FromDiscord<mario2> I just want to make games and not end up with games that require 8+ GB of memory and thought I could optimize things further by compiling as if I was on an embedded system.
11:19:44FromDiscord<Rika> It doesn’t work that way
11:19:55liblq-devre: can I still compile it for an embedded program even though it's on a modern system?
11:19:55liblq-devthat's not really how embedded development is done. you'd have to impede your PC version's functionality a lot as things like dynamic allocation are a big no-no for embedded
11:20:09Clonkk[m]<PMunch "@mario2, there are a couple ways"> Doesn't generating code and calculating values at compile time increase binary size ?
11:20:16PMunchEmbedded uses less resources because the programmers that program against embedded knows that they don't have all that many resources.
11:20:17liblq-devalso: RAM is there to use it
11:20:23liblq-devnot as poorly as electron apps of course
11:20:29liblq-devbut if you need it - take it
11:20:39PMunch@Clonkk[m], depends on the code you generate and the values you pre-compute
11:20:42FromDiscord<Rika> In reply to @Clonkk "<PMunch "<@819365433332727828>, there are": Yes, but if the runtime cost is higher you’d rather the binary size cost
11:20:46PMunchYou can end up saving space
11:21:07FromDiscord<mario2> I just want the final processor requirements and system requirements to be as low as possible for my games.
11:21:25FromDiscord<mario2> So I thought I could compact it by disabling GC.
11:21:29FromDiscord<Yardanico> no
11:21:32FromDiscord<Rika> Then code efficiently, no way around it I guess
11:21:42FromDiscord<Rika> Disabling GC will increase RAM usage
11:21:48FromDiscord<Yardanico> you can use ARC and then you don't really have a "GC"
11:21:48liblq-dev@mario2 i thought the same when i was just starting out and i'll just say that you'll end up hitting brick walls every two steps if you do that
11:22:18PMunchImagine calculating points on a circle in order to draw it with straight lines for example. If you pre-compute this into a couple of integers you have saved yourself from importing a floating point emulation library and the code to calculate those points. Not only is it faster on runtime, but also saves you a couple kilobytes of memory for not having to import floating point support.
11:22:18liblq-devcomputers are not as slow as you think they are
11:22:25FromDiscord<Yardanico> guess I should use `--spellsuggest:3` instead of the default https://media.discordapp.net/attachments/371759389889003532/821342637197099018/unknown.png
11:23:05FromDiscord<Rika> What is that?
11:23:11PMunch@mario2, have you actually written a game in Nim that uses 8Gb of memory?
11:23:20Clonkk[m]<PMunch "Imagine calculating points on a "> I remember having issue with ROM size when doing embedded GUI with littlevgl. Embedding raw bmp image is faster but take more space than png (but you need to decode it)
11:23:31FromDiscord<Yardanico> @Rika --spellsuggest
11:23:32FromDiscord<mario2> I only said 8GB of memory because lots of games these days are requiring that much.
11:23:36FromDiscord<Rika> Which does?
11:23:40liblq-devwhen you're doing a game, don't try to make it the fastest thing ever - most modern games are written in C# and similar high-level, GC-heavy languages, and computers don't even break a sweat while running them
11:23:46FromDiscord<Yardanico> @Rika https://github.com/nim-lang/Nim/pull/16067
11:23:48liblq-devmodern indie games*
11:23:57FromDiscord<Rika> In reply to @liblq-dev "when you're doing a": RimWorld would beg to differ
11:24:06Clonkk[m]<FromDiscord "<mario2> I just want the final p"> First make something that works, then if it uses too much ressources optimize it. Don't start worrying about ressources if you haven't coded it yet
11:24:07PMunch@Clonkk[m], oh for sure, it very much depends on the specific use case.
11:24:07liblq-dev@Rika alright not most of them
11:24:10liblq-devbut a lot of them
11:24:29FromDiscord<Rika> In reply to @Yardanico "<@!259277943275126785> https://github.com/nim-lang/": Will look
11:24:30FromDiscord<Goel> Factorio is so well optimized that it can be run on a potato
11:24:41FromDiscord<mario2> @Goel I want my games to run on a potato.
11:25:00PMunchThen write them in Nim and don't do stupid costly mistakes
11:25:06liblq-devwell what kind of game are you making
11:25:06FromDiscord<Rika> Factorio can run with a billion mods yet RimWorld struggles to run with a few tens of them...
11:25:25PMunchExample of a stupid costly mistake: https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/
11:25:31FromDiscord<mario2> I don't know what kind of game I'm making. Not yet. I'm not expecting GTA V like games to be able to run on a toaster, but I don't want to overly bloat it either.
11:25:35FromDiscord<Rika> In reply to @mario2 "<@!312201286567198720> I want my": Make the game first, then optimise. Do you know about the premature optimisation quote?
11:26:05liblq-devif it's just a platformer don't worry about overly optimizing it
11:26:11liblq-devunless you have millions of objects on the screen at once
11:26:12Clonkk[m]<FromDiscord "<mario2> I don't know what kind "> Never optimize something that does not exists
11:26:39FromDiscord<mario2> If I was to optimize, should I be optimizing via compile flags or via how I program it?
11:26:45FromDiscord<Yardanico> both?
11:26:47liblq-devthe latter
11:26:53FromDiscord<Rika> Both
11:26:58liblq-devideally your game should run at 60 fps in debug mode
11:27:05FromDiscord<Yardanico> with --opt:speed
11:27:12FromDiscord<Yardanico> (that'd still be debug mode)
11:27:18FromDiscord<Rika> What is default opt?
11:27:21FromDiscord<Yardanico> @Rika none
11:27:22FromDiscord<Rika> Size?
11:27:24liblq-devi don't like --opt:speed because it slows down compilation times significantly
11:27:26FromDiscord<Rika> Huh there’s a none
11:27:28FromDiscord<mario2> You said disabling garbage collection is a bad thing?
11:27:30FromDiscord<Yardanico> @liblq-dev not for me
11:27:33FromDiscord<Rika> Always thought it was one or the other
11:27:33liblq-devuntil we have IC i ain't touching it for development
11:27:44liblq-devs/until/unless
11:27:53FromDiscord<Yardanico> bad sed
11:27:57FromDiscord<Rika> Well technically until works
11:28:34liblq-devi mean you can apply compiler flags to make your code faster but why do that if it'll impede prototyping speed
11:28:51FromDiscord<Rika> Depends on how much you value your time
11:29:04liblq-devi don't even know why but my darn game takes ~7s to compile
11:29:15liblq-devi have a hunch that codegen takes most of that time
11:29:46liblq-devbecause my code is quite concept-heavy and concept caching is non-existent
11:30:01FromDiscord<mario2> Is it a bad idea to disable garbage collection if I care about performance speed? I don't really mind increasing the size of the game as long as it doesn't expand the size by x10 times or something like that.
11:30:01PMunchYeah concepts slow the compiler right down
11:30:19FromDiscord<Yardanico> @mario2 yes it is
11:30:20PMunch@mario2, yes, enable ARC, don't disable the gc..
11:30:24FromDiscord<Yardanico> without a GC you'd have to manage all memory by yourself
11:30:30FromDiscord<Yardanico> and won't be able to use stdlib
11:30:36FromDiscord<Yardanico> (well technically you could, but it'll leak memory)
11:30:44FromDiscord<Rika> Well you will, you’ll just die of memory usage
11:31:23liblq-devdon't worry about the GC
11:31:25liblq-devit's fast
11:31:28PMunchIf you disable the GC you will 90% sure leak memory and memory consumption would be massive. With the GC you don't have to think about it, just make sure to reset any big global variables if you're not using them.
11:31:48*FromDiscord quit (Remote host closed the connection)
11:31:51*rockcavera joined #nim
11:32:05*FromDiscord joined #nim
11:32:16PMunchAnd even if you didn't leak memory you would spend 50x the dev-time and be in for a lot of pain for absolutely zero gain.
11:32:18liblq-devmy sister's shitty laptop can run my game with an old version of the current default GC just fine
11:32:29FromDiscord<Rika> You have bigger bottlenecks to deal with over the GC
11:32:31FromDiscord<mario2> As long as I'm not poorly optimizing like source 1 is I'm good. TF2 used to be able to run on a toaster and now it can't because of years of code buildup.
11:32:33FromDiscord<clyybber> @Yardanico I guess we could disable pings without `@` for names with a length <= 3 ?
11:32:37FromDiscord<konsumlamm> ~~eith ARC it's easy to leak memory too~~
11:32:53FromDiscord<Yardanico> @konsumlamm cycles are not that frequent
11:32:54PMunchIf you find out later that you have something that could be optimised by not running it under the GC you can manually manage the memory for that section while leaving the GC on for the rest of your program.
11:32:55FromDiscord<Rika> In reply to @mario2 "As long as I'm": That depends on your programming
11:32:58FromDiscord<Rika> Not the GC
11:33:09FromDiscord<Yardanico> stdlib has almost no cycles and in in your code you should care about that ofc
11:33:13FromDiscord<clyybber> In reply to @Clyybber "<@!177365113899057152> I guess we": I'll make a PR
11:33:28FromDiscord<Yardanico> @clyybber I mean we actually had something like that before
11:33:31FromDiscord<Yardanico> but another thing is
11:33:46FromDiscord<Yardanico> make it so that "ping" matches only if it's at the start of the string or has a space before it
11:33:51FromDiscord<Yardanico> hm, or a comma I guess
11:34:07FromDiscord<clyybber> but we also wan't to support suffix pings right?
11:34:12FromDiscord<clyybber> I guess that's unrelated
11:34:41*xet7 quit (Remote host closed the connection)
11:35:55FromDiscord<Yardanico> we support "@name", "ping name", "Name: message" at the start of the message, "Name, message" at the start of the message
11:36:46FromDiscord<clyybber> I think we should just check if there's a non-alphanumeric char before `mention`
11:37:25FromDiscord<clyybber> because you wouldn't want to ping someone called "emailserver" if someone goes "someone@emailserver"
11:38:21FromDiscord<Yardanico> also, do the string slicing with [] and substr have same performance?
11:39:36FromDiscord<clyybber> should be the same roughly
11:39:45FromDiscord<clyybber> (edit) removed "roughly"
11:39:54FromDiscord<Yardanico> asking because of https://github.com/soasme/nim-markdown/commit/0061c5fdfde0627eb7d51d88c1aa0aaa5d8b30c1
11:40:03FromDiscord<Yardanico> "By replacing [] to substr, the performance is improved. It seems to me they're not of the same efficiency."
11:40:10FromDiscord<clyybber> huh
11:40:22FromDiscord<clyybber> @Yardanico what's the reason we are returning `mention` instead of `nick`?
11:40:34FromDiscord<clyybber> (edit) "`mention`" => "`mentions`"
11:40:52FromDiscord<Yardanico> @clyybber wdym?
11:40:54FromDiscord<Yardanico> we capture the nick
11:41:00FromDiscord<Yardanico> ` >nick <- +(Alnum | '_' | utf8.alpha)`
11:41:02FromDiscord<clyybber> oh nevermind, yeah I got confused by the peg naming
11:41:11FromDiscord<clyybber> because it goes `peg mentions:`
11:41:22FromDiscord<Yardanico> oh yeah that's the root expression
11:41:45FromDiscord<clyybber> yeah
11:52:35*FromDiscord quit (Remote host closed the connection)
11:52:42*kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in)
11:52:57*FromDiscord joined #nim
11:52:58*kitech1 joined #nim
11:53:14Yardanicohoping you
11:53:17Yardanico@you
11:53:21Yardanico@Yardanico hi
11:53:38Yardanicogood enuf
11:54:07*clyybber joined #nim
11:57:17*clyybber quit (Client Quit)
11:57:25m4r35n357OK we are getting into minor details here, but in the following (working) code I have used seqs to set up arrays of different sizes within a case statement. I have not been able to make it work using bare arrays owing to the need to specify size up front. In c I have used "compound literals" to do this, is tthere a way in Nim?
11:57:29m4r35n357https://pastebin.com/E27fq9NB
11:58:06FromDiscord<Yardanico> yeah you can't use arrays here
11:58:22m4r35n357OK quick answer, cheers ;)
11:58:27FromDiscord<Yardanico> because order is a runtime variable
11:58:34FromDiscord<Yardanico> and you decide seq length based on it
11:58:42FromDiscord<Yardanico> but array size should be known at compile time
11:59:14m4r35n357yeah in c I can just initialize a compound literal of [0] at the "top", and overwrite it in the switch
11:59:17FromDiscord<Araq> ` 0.5 h (z1 + z0) y0 x1, h z0 y0 x1, 0.5 h (z0 + z1) y0 x1, h z1 y0 x1,` screams for a template
12:01:16m4r35n357hmm, haven't looked at templates yet, such an overloaded term ;) BTW. c example is at the bottom of https://github.com/m4r35n357/ODE-Playground/blob/blackhole/dual.c
12:01:45m4r35n357but seqs are fine here I think
12:02:18FromDiscord<Araq> Nim's `template` is a well defined entity which you can read about in our manual.
12:02:28FromDiscord<Yardanico> you can definitely shave off a lot of repetition here https://media.discordapp.net/attachments/371759389889003532/821352712687583242/unknown.png
12:03:12m4r35n357Araq, just been reading about them, not sure how or where they can help . . .
12:03:46FromDiscord<Araq> also, instead of magic numbers like -6, https://github.com/m4r35n357/ODE-Playground/blob/blackhole/dual.c#L171, use an enum
12:05:54PMunchI mean those blocks could just be assigned to a let and computed once before the creation of the sequence (not that it would matter for performance, GCC or the Nim compiler will probably do exactly that for you). But the cases where just one variable changes from place to place can definitely be optimised with a template
12:06:00PMunchOptimised for readability that is
12:06:19PMunchWithout losing performance
12:06:34m4r35n357Araq, I take your point about enums, but I don't think templates will help in the example you gave, there is simply no significance to that sequence, even if it is "repeated"; the formatting is arbitrary
12:06:53FromDiscord<mario2> Would it be redundant or pointless to make a language that compiles to nim? Or should I make one that just compiles to C instead? I'm thinking about making my own language, but not sure if compiling to nim is pointless.
12:07:03m4r35n357PMunch, they are only computed once in any case, so it doesn't matter I don't think
12:07:04*ryanhowe quit (Quit: ZNC 1.8.2 - https://znc.in)
12:07:16m4r35n357I could just provide the values!
12:07:43*sacredfrog joined #nim
12:07:58PMunch@mario2, you will likely get what you think you need from making your own language by simply creating Nim macros.
12:08:15FromDiscord<mario2> Even if the syntax is different?
12:08:40FromDiscord<InventorMatt> that would depend on how different you want the syntax to be
12:08:49FromDiscord<Araq> @mario2 if you compile to C you would need to reimplement memory management and error handling and closures... but if your language lacks all these things it doesn't matter
12:09:45PMunchI feel like this is another mis-guided attempt at getting performance
12:10:14FromDiscord<mario2> In reply to @PMunch "I feel like this": No. No. This has nothing to do with performance. I like computers and always wanted to make my own language.
12:10:28PMunchAh right, well in that case feel free :)
12:10:50PMunchMaking your own language can be fun, but it will definitely be painful
12:10:53FromDiscord<InventorMatt> alot of people make interpreters in nim that could get you the same result
12:11:56FromDiscord<haxscramper> In reply to @mario2 "Would it be redundant": nim macros are basically your own language that compiles to nim
12:12:01FromDiscord<haxscramper> In some sense at least
12:12:05FromDiscord<Rika> Syntax rules apply though
12:12:43FromDiscord<mario2> Let me explain the syntax a bit. I want something COBOL like because I'm currently fascinated with how it writes like plain english. Can that be pulled off with macros? Or should I write a new compiler instead?
12:13:12FromDiscord<InventorMatt> that could probably be done in macros
12:13:26FromDiscord<Rika> Should be fine in macros
12:13:30*FromDiscord quit (Remote host closed the connection)
12:13:45*FromDiscord joined #nim
12:13:50*FromDiscord quit (Remote host closed the connection)
12:14:03*FromDiscord joined #nim
12:14:16FromDiscord<haxscramper> @mario2 if you are talking about SQL/COBOL-style styntax with `take string repeat 10 times store` or `select cat from table` then you'd probably have a bit of trouble making nim syntax fit into that, but that's not impossibly
12:14:18FromDiscord<haxscramper> Thouggh I would say you can just write well-named functions
12:14:26FromDiscord<haxscramper> And get almost the same result, with a little of sugar
12:14:29FromDiscord<haxscramper> if you want
12:14:34FromDiscord<haxscramper> But don't use macros for sugar, use for DSL
12:14:40FromDiscord<Araq> cobol"""↵ any syntax you want here↵"""
12:14:53FromDiscord<haxscramper> ^ and of course that would work too
12:14:57FromDiscord<Araq> still pretty simple, you need a compile-time parser for your language, that's all
12:14:58FromDiscord<InventorMatt> @mario2 here is an example use of a macro i designed for creating fuzzy logic rules in plain english using nim https://github.com/mhessler97/NimFuzzy/blob/master/tests/SimpleMacroTest.nim
12:15:47FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2T2t
12:15:55FromDiscord<mario2> @InventorMatt Oh that is very COBOL like. I'll make a bunch of macros to turn Nim to NIMBOL. Or something like that.
12:17:04PMunch@m4r35n357, tried to apply some templates to your code, but it's still pretty messy. I expect these things might follow a pattern though?
12:17:24FromDiscord<mario2> Thanks guys. I don't need to make a new language after all. Templates and Macros is all I need.
12:17:52FromDiscord<Rika> I’m thinking of making a front end for z3, is anyone working on that in secret?
12:18:19FromDiscord<Araq> DrNim uses z3
12:18:41FromDiscord<Rika> I have forgotten about that
12:18:47FromDiscord<Rika> How is progress by the way?
12:18:55m4r35n357PMunch, the pattern is there but not obvious, creating that sequence is firmly rooted in the problem domain, it is not a general computing thing
12:19:49m4r35n357PMunch, if you look at the c code link you can see echoes of the "pattern", but it is still not very clear.
12:20:18*vsantana joined #nim
12:20:47FromDiscord<Araq> exactly, the pattern is obfuscated because of the copy&paste
12:21:02*FromDiscord quit (Remote host closed the connection)
12:21:20m4r35n357Araq, I put it all into one line because it was no clearer befoerhand ;)
12:21:22*FromDiscord joined #nim
12:21:34FromDiscord<Araq> but PRs are welcome and the tests are green
12:21:36FromDiscord<Rika> I see
12:22:25PMunchm4r35n357, well if there is any kind of pattern you can code instead of copy/paste then it might be a good idea to do that..
12:23:44PMunchOr even just some kind of sequence initialise macro to remove the repeats
12:23:49PMunchIs there a DSL for that?
12:24:34*Nuc1eoN left #nim ("The Lounge - https://thelounge.chat")
12:24:38m4r35n357PMunch, one of us is not understanding the other ;) The sequence of numbers is messy and that is the best that I know how to do
12:25:10PMunchI mean you have a lot of repetition, would be easy to write a tiny dsl that got rid of that
12:26:09m4r35n357PMunch, ifyou really want to know where the numbers come from, see here: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1048.973&rep=rep1&type=pdf
12:26:30FromDiscord<haxscramper> I just formatted it using clang-format, and I see that `h z1 y1 x1` are repeated very often (as well as ` 0.5L h (z0 + z1) y1 x1`)
12:26:55FromDiscord<haxscramper> If you absolutely need array literals it is possible to repeat arrays at compile-time, so no allocations, nothingg
12:27:04FromDiscord<haxscramper> There was a forum thread with code, let me find it
12:27:09*FromDiscord quit (Remote host closed the connection)
12:27:27*FromDiscord joined #nim
12:28:00FromDiscord<haxscramper> So you could just do `([z1 y1 x1] 10) & [<some-other>] <repeat-times>` and compile-time constant
12:29:30FromDiscord<haxscramper> https://forum.nim-lang.org/t/7480#47429
12:32:07FromDiscord<haxscramper> Or if indices follow some pattern you can just generate macro that unrolls into array literal like that `repeatArray({(h z1 y1 x1) : [1,2,3,4], (0.5L h (z0 + z1) y1 x1) : [5,6,7], <expression> : <indices> ...})`
12:32:21m4r35n357haxscramper, this code is copied & pasted from working code I wrote several years ago. I am _still_ not foolhardy enough to revisit its derivation, or to code it up ;)
12:32:34m4r35n357It just isn't worth it - it works
12:32:52m4r35n357and very nicely too
12:33:25FromDiscord<Araq> how do you know it works very nicely? good test coverage? if so, refactoring it is not a big deal 😉
12:33:46m4r35n357haxscramper, but I will offer any assitance that you might need if you want to attempt it ;)
12:34:46m4r35n357Araq, I have very good numerical error reporting & display, it is _really_ obvious if something is wrong
12:35:32FromDiscord<Araq> you shouldn't fear to touch this code then but ok, who am I to tell you want to do
12:35:43m4r35n357Araq, not a big deal, but it gains me nothing. If it helps, look at it as a big crypto key or some data like that
12:35:46FromDiscord<Araq> (edit) "you shouldn't fear to touch this code then but ok, who am I to tell ... you" added "what"
12:36:09FromDiscord<Araq> I don't look at it, I run away screaming
12:36:12m4r35n357Araq, I have no fear as I said, I know immediately if something is wrong
12:38:07m4r35n357Araq, also I have previous implementations in Vala, Python, Fortran & c to compare with.
12:38:23m4r35n357It is not code that is _ever_ changed
12:38:39m4r35n357on pain of death!
12:40:43FromDiscord<Araq> alright, alright
12:40:50m4r35n357Araq, if the crypto key analogy doesn't work for you, think of doing a big symbolic calculation in (e.g.) maxima, then pasting the result into a program & reformatting by hand.
12:40:54PMunchWhy does this generate an error? https://play.nim-lang.org/#ix=2T2B
12:40:55FromDiscord<mario2> sent a code paste, see https://play.nim-lang.org/#ix=2T2C
12:41:41PMunchYou'd need a macro
12:41:49FromDiscord<Araq> @mario2 you should go with the `dsl""" ... """` idea
12:42:19FromDiscord<Araq> where `dsl` must be a macro
12:42:36FromDiscord<mario2> So in other words: Metaprogramming?
12:43:40FromDiscord<arnetheduck> @Araq just to verify, `deepCopy` is not thread safe, right?
12:43:58FromGitter<HJarausch_gitlab> I must be blind - please help. ⏎ ⏎ ```echo quickSelect(A)``` ⏎ ⏎ What did I overlook? ... [https://gitter.im/nim-lang/Nim?at=6050a80eb5131f4f281bddca]
12:46:13FromDiscord<Araq> @arnetheduck you have to ensure that the thread that belongs to `source` doesn't continue until the deepcopy is over
12:46:51FromDiscord<arnetheduck> In reply to @Araq "<@449019668296892420> you have to": yeah, that's what I imagined - just checking that there isn't some hidden magic that I missed
12:46:51*Gustavo6046 quit (Ping timeout: 272 seconds)
12:48:31FromDiscord<Araq> the black magic is inside `spawn`
12:49:43FromDiscord<Araq> where the pool worker thread announces that it is ready to take a task and then there is a single deep copy of this task from the submitting thread to the worker
12:50:16PMunchCan anyone tell what the issue in my code is? typeof says seq[int], len works fine, but I can't echo it..
12:50:22PMunchI can echo y[0] though
12:50:48*FromDiscord quit (Remote host closed the connection)
12:51:02*FromDiscord joined #nim
12:51:34FromDiscord<Araq> so that in effect you get one copy and not two. but it's a terrible idea, and I will never write it like this again
12:56:08PMunchI mean the for loop here works fine, but not the echo: http://ix.io/2T2H
12:59:18FromDiscord<Araq> @PMunch report it on github please, most interesting bug
12:59:45*FromDiscord quit (Remote host closed the connection)
12:59:59*FromDiscord joined #nim
13:00:28*FromDiscord quit (Remote host closed the connection)
13:00:44*FromDiscord joined #nim
13:01:16PMunchOh hmm
13:01:18FromDiscord<Seedofarson> Nimmmmmmmm
13:01:19FromDiscord<Seedofarson> go brrrrrrrrrrrrrrrr
13:01:26PMunchIt seems to be caused by macroutils..
13:01:34PMunchDamn it, guess it's my own fault then somehow
13:02:21PMunchAlthough the output from echo result.treeRepr is exactly the same for both versions
13:04:30FromDiscord<arnetheduck> In reply to @Araq "so that in effect": well, from what I can tell, there's nothing in the language that stops deepcopy from copying from a source that's in another thread which is.. odd.. I mean, gcsafe is a bit about that
13:04:57FromDiscord<arnetheduck> at that point, it's basically an unchecked memory unsafety issue
13:05:56FromDiscord<arnetheduck> but then again, maybe I'm missing something in the code I'm looking at
13:06:03*FromDiscord quit (Remote host closed the connection)
13:06:19*FromDiscord joined #nim
13:07:51*Gustavo6046 joined #nim
13:08:42FromDiscord<Araq> I don't see how the deepcopy alone can cause memory unsafety.
13:09:47FromDiscord<Araq> if dest and source are on different threads you can only access source via an unsafe means and then that's where the unsafety comes from
13:10:58FromDiscord<arnetheduck> might be, I haven't read _all_ code yet, just found a dubious bit 🙂
13:11:06FromDiscord<Araq> for example, `deepCopy(dest, someGlobal)` triggers the "GC safety" problem as you access `someGlobal`
13:11:33FromDiscord<Araq> and when you do `{.gcsafe.}: deepCopy(dest, someGlobal)` it remains wrong but you made the compiler shut up about it
13:13:59PMunchHmm, just importing macroutils makes it fail..
13:13:59FromDiscord<arnetheduck> ok, yeah, found it - there's a `gcsafe` indeed, but far away from the deepCopy
13:14:05FromDiscord<arnetheduck> thanks
13:14:09PMunchEven `import macroutils except Lit`
13:15:05PMunch`from macroutils import Prefix, Bracket, Ident` works though
13:15:16PMunchSo it's definitely something in macroutils that is messing things up
13:16:16PMunch`from macroutils import Lit` triggers the error though
13:16:33PMunchSo it seems like `import macroutils except Lit` doesn't do what it's supposed to..
13:22:54m4r35n357OK I'mm getting near to "finishing" this little project, and it has developed into a virtual rewrite of an old project, but in an expressive language. I am really pleased with it; don't let my questions here give you the impression that I have been struggling, I've enjoyed it! The current version of my code is mixed in with lots of other stuff here: https://github.com/m4r35n357/ODE-Playground/tree/blackhole
13:24:05m4r35n357I don't know how many prople use Nim for numeric stuff, but here is proof that it is possible (128 bit floats would be nice though!)
13:24:29m4r35n357So thanks agin for all your help, in case I decide to disappear suddenly ;)
13:26:48FromDiscord<InventorMatt> we do have a bit of a science community and we even have a science nim channel as well. it's always good to see more scientific programming in nim
13:27:42*FromDiscord quit (Remote host closed the connection)
13:27:59*FromDiscord joined #nim
13:28:15*narimiran quit (Ping timeout: 265 seconds)
13:28:37FromDiscord<Yardanico> on irc it's #nim-science btw @m4r35n357
13:29:05PMunchm4r35n357, no worries, from the questions you asked it seemed like you had a pretty good grip about what you were doing so it seemed like you were getting along well with the language :)
13:29:08m4r35n357InventorMatt well that project covers high order Taylor Series Integrators, & high order symplectic integrators as well as black holes, ODEs etc
13:31:50m4r35n357PMunch, ys I've ploughed this furrow many times, but this is the smallest & clearest expression off the problem yet (ignoring distractions re. weighting data!). The two features that have made the difference are operator overloading, and bind many generics (in that order)
13:31:58FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2T2V
13:32:54PMunchYeah, being able to manipulate the language to the point that Nim allows really makes it possible to write expressive code no matter the domain
13:39:02FromDiscord<Seedofarson> uh
13:39:51FromDiscord<Seedofarson> sent a code paste, see https://play.nim-lang.org/#ix=2T2Z
13:39:54FromDiscord<Seedofarson> I get a syntax error
13:39:56*FromDiscord quit (Remote host closed the connection)
13:40:12*FromDiscord joined #nim
13:40:24FromDiscord<Rika> well what did it say
13:40:26FromDiscord<Seedofarson> oop
13:40:26FromDiscord<Seedofarson> my nad
13:40:28FromDiscord<Seedofarson> (edit) "nad" => "bad"
13:40:28FromDiscord<Seedofarson> sent a code paste, see https://play.nim-lang.org/#ix=2T30
13:40:31FromDiscord<Rika> haha
13:40:31PrestigeWhy does the bridge keep dying
13:40:56FromDiscord<Seedofarson> sent a code paste, see https://play.nim-lang.org/#ix=2T32
13:41:02*FromDiscord quit (Remote host closed the connection)
13:41:17*FromDiscord joined #nim
13:41:33FromDiscord<haxscramper> `delay: int) = ...`
13:41:45FromDiscord<Seedofarson> oh
13:41:46FromDiscord<Seedofarson> lmaoo
13:41:47FromDiscord<Seedofarson> my bad
13:41:48*FromDiscord quit (Remote host closed the connection)
13:42:04*FromDiscord joined #nim
13:42:16FromDiscord<Seedofarson> getting used to new syntax
13:42:20FromDiscord<Seedofarson> tysm
13:43:34PMunchPrestige, I'm not sure if it's dying, I think Yardanico might be working on it
13:43:42Yardaniconah, it's crashing
13:43:53YardanicoI don't develop the bridge on the main instance, y'know :)
13:43:59YardanicoI only test it in #nim-test when developing
13:44:20Yardanicothese are crashes because of display name stuff
13:44:22Prestigeo
13:44:32*FromDiscord quit (Remote host closed the connection)
13:44:45*FromDiscord joined #nim
13:44:49Yardanicoit's optional in discord and I didn't have enough isSome checks I guess
13:44:53*FromDiscord quit (Remote host closed the connection)
13:45:07Yardanicoi reverted it back for now
13:45:11PMunchAha
13:45:14*FromDiscord joined #nim
13:45:27PMunchI mean I wouldn't be surprised if you were developing it on the live version :P
13:45:35FromDiscord<Seedofarson> thats correct
13:45:38FromDiscord<Seedofarson> sent a code paste, see https://play.nim-lang.org/#ix=2T37
13:45:39FromDiscord<Seedofarson> right?
13:45:42FromDiscord<Seedofarson> just making sure haha
13:46:19FromDiscord<Seedofarson> (edit)
13:46:23FromDiscord<Rika> yes
13:46:24*clyybber joined #nim
13:46:57*clyybber quit (Client Quit)
13:47:26FromDiscord<Yardanico> @Seedofarson you can ask the compiler, it'll certainly let you know whether it's correct or not
13:47:38FromDiscord<Seedofarson> rip
13:47:41FromDiscord<Seedofarson> sent a code paste, see https://play.nim-lang.org/#ix=2T3b
13:47:53FromDiscord<Seedofarson> In reply to @Yardanico "<@!798398880584171530> you can ask": I am getting another error so I was wondering if it was the same thing! haha
13:47:55FromDiscord<Seedofarson> ty
13:48:07FromDiscord<Yardanico> @Seedofarson you can't have an empty else.
13:48:12FromDiscord<Seedofarson> oh shit
13:48:15FromDiscord<Seedofarson> (edit) removed "shit"
13:48:30FromDiscord<Seedofarson> sorry if I am being annoying
13:48:31FromDiscord<Yardanico> and it's pointless to delete messages since they're already been logged
13:48:39FromDiscord<Seedofarson> im on my merry way now
13:48:39FromDiscord<Yardanico> (edit) "they're" => "they've"
13:48:48FromDiscord<Seedofarson> ?
13:48:49FromDiscord<Rika> annoying is something you are not
13:57:06YardanicoPMunch: time to use your optionsutils :)
13:57:13Yardanicooptionutils*
13:57:32*fredrikhr quit (Read error: Connection reset by peer)
13:57:56*fredrikhr joined #nim
14:01:43Yardanico let name = either(m.member?.nick, m.author.username)
14:02:24Yardanicoactually just m.member?.nick.get(m.author.username)
14:07:46PMunchHooray :)
14:07:56PMunchSomeone using my stuff is always fun
14:09:16Yardanicowell I already use your parsetoml in ircord for configuration :)
14:10:37PMunchWell that's not really mine as such. I just rewrote large parts of it to support newer versions of the spec
14:19:42*NimBot joined #nim
14:19:53*gpanders quit (Quit: ZNC - https://znc.in)
14:20:11Yardanico~restarting the bridge~
14:20:14*FromDiscord quit (Remote host closed the connection)
14:20:38*FromDiscord joined #nim
14:21:02*lritter quit (Quit: Leaving)
14:21:29*gpanders joined #nim
14:27:44PMunchOOM'd? Do you have a leak?
14:28:14Yardaniconot me, NimBot
14:28:40Yardanico!eval 1+1
14:28:42NimBotCompile failed: /usercode/in.nim(1, 2) Error: expression '2' is of type 'int literal(2)' and has to be used (or discarded)
14:31:26PrestigeWhat does NimBot does aside from eval?
14:31:58Prestigewhat does nimbot do* man I'm tired
14:32:27Prestige!help
14:32:30Prestigeoh well.
14:34:43YardanicoPrestige: main feature is irc logging
14:35:43Yardanicoand the src is open anywya
14:35:51Yardanicohttps://github.com/nim-lang/nimbot
14:37:21YardanicoPrestige:
14:37:22Yardanico!ping
14:37:22NimBotpong
14:38:10Yardanico!lag
14:38:10NimBot10ms between me and the server.
14:48:48*sepples_ quit (Ping timeout: 245 seconds)
14:49:29*clyybber joined #nim
14:52:19FromDiscord<whisperdev> Does anyone know what kind of regex repl I can use for this? https://nitely.github.io/nim-regex/regex.html
14:53:26FromDiscord<Yardanico> normal one will work
14:53:28FromDiscord<Yardanico> pcre
14:53:37FromDiscord<Yardanico> "The syntax is similar to PCRE"
14:53:40FromDiscord<Yardanico> at the top of the page :)
14:53:58FromDiscord<Yardanico> and for that there's the classical https://regex101.com/
14:55:20FromDiscord<whisperdev> I cant make it work though.Does the nim playground support importing this package?
14:56:43FromDiscord<Yardanico> @whisperdev wdym?
14:56:53FromDiscord<Yardanico> about "can't make it work"
14:57:01FromDiscord<Yardanico> and yes, playground has it
14:59:01FromDiscord<whisperdev> Yes that's what I am going to illustrate on playground 🙂
14:59:34FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T3F
14:59:45FromDiscord<Livingstone> I'm getting the error generic min
14:59:58FromDiscord<Livingstone> can someone tell me what that means?
15:00:05FromDiscord<Yardanico> there's no `min` for seq[seq[float]]
15:00:08FromDiscord<Yardanico> how would you expect it to work?
15:00:36FromDiscord<Livingstone> to take the two numbers in a list within a list and compare them?
15:00:43FromDiscord<Yardanico> @Livingstone but you have a sequence of sequences of floats
15:00:45FromDiscord<Yardanico> not just a sequence of floats
15:00:57FromDiscord<InventorMatt> You'll need to iterate through each seq in the seq and call that on it
15:00:59FromDiscord<Yardanico> you'll need a loop or use sequtils if you really want the min and max values from the whole dataset
15:01:11FromDiscord<Rika> min -> seq[T], T needs <, how do you compare two seq[float]s?
15:01:28FromDiscord<Rika> `@[0.0] < @[1.0, 2.0]` doesnt make sense
15:05:35*teasea quit (Quit: teasea)
15:07:10FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2T3S
15:07:32*teasea joined #nim
15:07:50FromDiscord<Livingstone> that could probably work because my python code looks like this
15:08:00FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T3T
15:08:36FromDiscord<InventorMatt> so you want a list of the min_max values as your output?
15:08:46FromDiscord<Livingstone> yes
15:10:32FromDiscord<Yardanico> range(len)) pls no
15:10:46FromDiscord<Yardanico> jk :P
15:10:50FromDiscord<Livingstone> lol
15:12:24FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2T3V
15:12:58FromDiscord<InventorMatt> it'll give a seq with the tuple pair of the minimum and maximum in each subseq
15:14:44FromDiscord<Livingstone> could work I will give a try
15:14:57FromDiscord<Livingstone> thanks
15:26:12FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2T3Z
15:33:49*rockcavera is now known as Guest42956
15:33:50*Guest42956 quit (Killed (card.freenode.net (Nickname regained by services)))
15:33:50*rockcavera joined #nim
15:35:09FromDiscord<InventorMatt> sent a code paste, see https://play.nim-lang.org/#ix=2T41
15:42:34FromDiscord<hotdog> Anyone else had trouble with vscode freezing a lot recently?
15:51:27FromDiscord<martinium> nope
15:56:05FromDiscord<xophidia> sent a long message, see http://ix.io/2T49
16:08:05FromDiscord<Seedofarson> how do be threads work \:(
16:08:12FromDiscord<Seedofarson> there isnt to much documentation on the webiste
16:11:06FromDiscord<txtincome> What's the difference between nim and nimscript? Can I compile nim code if executed from a shell script?
16:12:11ForumUpdaterBotNew thread by Able: IndexError: list index out of range, see https://forum.nim-lang.org/t/7642
16:12:38FromDiscord<hotdog> @Seedofarson what are you trying to do? There's a lot of options here
16:13:10FromDiscord<Recruit_main707> you have to compile with `--threads:on` to use them
16:14:17FromDiscord<hotdog> @txtincome https://nim-lang.org/docs/nims.html
16:14:31FromDiscord<hotdog> Nimscript is interpreted
16:15:05FromDiscord<hotdog> Not sure I understand the second question, can you explain a bit more what you are trying to do?
16:15:39FromDiscord<txtincome> I want to call nim from shebang and then treat the file as if it was a shell script.
16:16:25FromDiscord<hotdog> Have a look at this: https://github.com/PMunch/nimcr
16:16:32FromDiscord<Yardanico> Yeah this is the way
16:16:51FromDiscord<txtincome> You're a genius hotdog. Thanks
16:19:57FromDiscord<txtincome> And even better, it's a very small program so if something breaks in the future it should be easy to fix.
16:24:58*zopsi joined #nim
16:31:52FromDiscord<KnorrFG> is it possible in an untyped macro to lookup a dotExpression, and get the type of the object that should be behind said dotExpression? And by type I actually mean I have a type with template args, and I want a description of the type without the template args.
16:32:15FromDiscord<KnorrFG> (edit) "template args," => "genericargs,"
16:32:21FromDiscord<KnorrFG> (edit) "genericargs," => "generic args,"
16:32:30FromDiscord<KnorrFG> (edit) removed "template"
16:33:50FromDiscord<txtincome> o noes https://thehackernews.com/2021/03/researchers-spotted-malware-written-in.html
16:34:48FromDiscord<exelotl> notta disu shitto agen
16:38:12reversem3I know enough C to be dangerous but thats about it , would learning more about C give me more insight into Nim ?
16:38:45*Jjp137 joined #nim
16:39:06FromDiscord<txtincome> Nim has a python like syntax and the C code isn't really meant to be human edited because of how it transpiled. You technically could read it, but it won't be pretty.
16:39:41FromDiscord<Yardanico> In reply to @txtincome "o noes https://thehackernews.com/2021/03/researcher": This has been posted here like 10 times already :)
16:39:55FromDiscord<txtincome> Sorry. I didnt' know
16:40:09FromDiscord<Yardanico> It's okay, also deleting is quite useless
16:40:19FromDiscord<Yardanico> Since we have people from IRC and this channel is logged
16:40:59FromDiscord<txtincome> @Yardanico To answer reversem3's question, is the C code meant to be human edited that was transpiled from nim code?
16:41:24FromDiscord<Yardanico> In reply to @txtincome "Nim has a python": He didn't really ask about C code compiled by Nim, it was about C in general
16:41:36FromDiscord<txtincome> Oh. I thought he meant something else
16:41:42FromDiscord<Yardanico> In reply to @txtincome "<@!177365113899057152> To answer reversem3's": No, C is merely used as a backend
16:41:54FromDiscord<Yardanico> It's not meant to be edited nor read
16:42:06FromDiscord<txtincome> Right. That's what I thought the C code was supposed to be.
16:42:18*Gustavo6046 quit (Remote host closed the connection)
16:43:04FromDiscord<txtincome> Is it possible to have nim tell GCC to stop at creating the assembly file or to have it stop after the object creation stage?
16:43:22*Gustavo6046 joined #nim
16:43:49FromDiscord<Yardanico> --noLinking to not link the binary but there are more options
16:44:02FromDiscord<Yardanico> See https://nim-lang.org/docs/nimc.htmlb
16:44:04FromDiscord<Yardanico> https://nim-lang.org/docs/nimc.html
16:53:10FromDiscord<Kiloneie> New video is up
16:53:11FromDiscord<Kiloneie> https://youtu.be/_FIHe1q0QYE
16:56:18ForumUpdaterBotNew thread by Kiloneie: Nim SDL2 Game Development for Beginners #2 Adding walls and explaining image depth, see https://forum.nim-lang.org/t/7643
16:56:48ForumUpdaterBotNew post on r/nim by Kiloneie: Nim SDL2 Game Development for Beginners #2 Adding walls and explaining image depth, see https://reddit.com/r/nim/comments/m6dmlf/nim_sdl2_game_development_for_beginners_2_adding/
16:59:49*xet7 joined #nim
17:03:23*icebattle quit (Ping timeout: 245 seconds)
17:04:24*narimiran joined #nim
17:05:59*kuon quit (Quit: Leaving)
17:19:34*icebattle joined #nim
17:23:24FromGitter<HJarausch_gitlab> Nim creates invalid C-code - WHY ⏎ See https://play.nim-lang.org/#ix=2T4J
17:25:27FromGitter<HJarausch_gitlab> Nim Compiler Version 1.5.1 [Linux: amd64] ⏎ Compiled at 2021-03-16 ⏎ Copyright (c) 2006-2021 by Andreas Rumpf ⏎ ⏎ git hash: 48eab5370a5e731059a7337f702b2bc42a3c4b79 ... [https://gitter.im/nim-lang/Nim?at=6050ea07457d6b4a94cdc6eb]
17:52:08*gpanders quit (Quit: ZNC - https://znc.in)
17:52:25PMunchtxtincome, as you can see nimcr hasn't been updated in ages. It so simple it just doesn't break :P I think I have multiple little scripts written with it and so far no issues
17:52:30*PMunch quit (Quit: leaving)
17:56:28*clyybber quit (Quit: WeeChat 3.1)
17:57:42FromDiscord<haxscramper> Wasm
17:57:50FromDiscord<haxscramper> Wasn't it made absolete by `nim r`?
17:58:01*Gustavo6046 quit (Remote host closed the connection)
17:58:46*Gustavo6046 joined #nim
18:02:16*Gustavo6046 quit (Remote host closed the connection)
18:02:48*Gustavo6046 joined #nim
18:11:58FromDiscord<Goel> Is there a way to compile all .nim files into a folder? like `nim c -r --all`?
18:12:06*Gustavo6046 quit (Remote host closed the connection)
18:12:21*Gustavo6046 joined #nim
18:13:53*nisstyre quit (Ping timeout: 260 seconds)
18:14:17FromDiscord<Kiloneie> Hopefully nim_lang on twitter retweets my video. That's the big one for getting traffic i believe.
18:14:37narimiran@Kiloneie you can count on it ;)
18:14:50FromDiscord<Kiloneie> Yay 😛
18:15:02*blitzworks quit (Ping timeout: 260 seconds)
18:15:50FromDiscord<haxscramper> In reply to @Goel "Is there a way": You need to compile multiple binaries at once, or something else?
18:16:02*nisstyre joined #nim
18:16:06FromDiscord<Solitude> In reply to @Goel "Is there a way": no, use your shell for-loops/xargs
18:16:17FromDiscord<haxscramper> Because nim does not work like C where you have to compile everything to `.o` and then link, it just happens automatically
18:16:47FromDiscord<Goel> binaries, a folder of examples, and i don't want to use nim c -r on every single .nim file. If thats possible
18:16:49FromGitter<timotheecour> > *<FromDiscord>* <haxscramper> Wasn't it made absolete by `nim r`? ⏎ ⏎ => followup https://github.com/PMunch/nimcr/issues/14
18:23:00narimiran@Kiloneie did you mention @nim_lang in your tweet? if not, please do, otherwise i cannot find your tweet easily....
18:23:15FromDiscord<Kiloneie> oh okay, second
18:25:33FromDiscord<Kiloneie> Done
18:29:11*waleee-cl joined #nim
18:33:20*wasted_youth2 joined #nim
18:34:53*couven92 joined #nim
18:35:02*fredrikhr quit (Disconnected by services)
18:35:08*couven92 is now known as fredrikhr
18:35:35*fredrikhr quit (Client Quit)
18:39:24*gpanders joined #nim
18:45:27*icebattle quit (Quit: leaving)
18:46:06FromDiscord<Rika> In reply to @Goel "binaries, a folder of": just use the shell's functions? and should help
18:47:56*icebattle joined #nim
18:49:20*gpanders quit (Quit: ZNC - https://znc.in)
18:49:36FromDiscord<txtincome> Which is faster: Compiling nim code to C or compiling the C code?
18:50:53*superbia joined #nim
18:51:20FromDiscord<zetashift> the compiling C code
18:51:43FromDiscord<txtincome> It really is faster to compile the C code rather than taking the nim code and making it into C?
18:51:53FromDiscord<Rika> pretty sure yeah
19:16:07FromDiscord<zetashift> From https://github.com/nim-lang/RFCs/issues/46 : `Currently in larger Nim projects, the Nim compiler is the bottleneck, not the C/C++ compiler. This is caused by the fact that the Nim compiler always recompiles the full program including all used libraries. `
19:20:18FromDiscord<Rika> well, its being worked on anyway
19:22:11FromDiscord<Goel> Empy window made with GLFW in Rust, binary size 55mb, in nim 2,8mb↵What the...
19:22:44FromDiscord<Rika> think rust is static
19:22:52FromDiscord<Rika> check with ldd
19:23:03FromDiscord<txtincome> Rust is huge
19:23:05FromDiscord<txtincome> C is tiny
19:23:22FromDiscord<Rika> rust isnt always huge, its just huge by default
19:23:32FromDiscord<Goel> I haven't used any flag or optimizations, still thats a HUGE difference in binary size for just an empy window made in the same mode
19:23:46FromDiscord<Goel> (edit) "mode" => "way"
19:31:41*leorize joined #nim
19:36:49*wasted_youth2 quit (Read error: Connection reset by peer)
19:37:15*wasted_youth2 joined #nim
19:42:48FromDiscord<konsumlamm> LTO makes a big difference
19:53:45*abm joined #nim
19:55:14*vicfred joined #nim
20:13:48*letto_ quit (Quit: Konversation terminated!)
20:14:49*haxscramper quit (Remote host closed the connection)
20:15:16*haxscramper joined #nim
20:16:07*letto joined #nim
20:17:22FromDiscord<txtincome> Are static analyzers like lint needed if I use nim? Would it be exploding with false positives because of how nim compiled the code?
20:17:47FromDiscord<Yardanico> if you use them on the C code, then probably yes
20:18:03FromDiscord<Yardanico> Also Nim compiled with -d:release has a lot of runtime checks enabled
20:18:10FromDiscord<Yardanico> Which help in reducing bugs
20:19:08FromDiscord<txtincome> Probably yes as in it would explode with false positives?
20:20:51*haxscramper quit (Remote host closed the connection)
20:21:07*arecaceae quit (Remote host closed the connection)
20:21:26*arecaceae joined #nim
20:26:40FromDiscord<treeform> In reply to @Kiloneie "New video is up": Wow nice! We need more vids. You are doing a good job keep it up.
20:30:04FromDiscord<Kiloneie> Thank you 🙂
20:30:47FromDiscord<Kiloneie> I gotta figure out a better program to draw with though, i used Window's 3D paint thingy in this one and it's horrible D:
20:31:03FromDiscord<Kiloneie> i launched Krita just before that but ended up not using it D:
20:38:23*narimiran quit (Ping timeout: 245 seconds)
20:38:59*Guest94576 joined #nim
20:49:07FromDiscord<zetashift> @Kiloneie why do you do `ImageObj = object of RootObj` & then `Image = ref ImageObj` ?
20:50:09FromDiscord<zetashift> Can't one do `Image = ref object of RootObj` ? Maybe you have explained it in the previous video, but sadly I haven't watched that one fully 😛
20:51:25*superbia quit (Quit: WeeChat 3.1)
20:54:31FromDiscord<Yardanico> @zetashift yes zetashift you can do that and usually it's used like this for inheritance
20:55:02FromDiscord<Kiloneie> That inheritance part honestly shouldn't be there
20:55:13FromDiscord<Kiloneie> i left in there and forgot about it D:
20:55:36FromDiscord<Kiloneie> if i were to edit that out... i did that once in a video, and nope... im not doing that again...
20:56:04FromDiscord<zetashift> In reply to @Yardanico "<@77574388035100672> yes zetashift you": "used like this for inheritance" -> with this you mean the way Kiloneie does or the the `Image = ref object of RootObj`?
20:56:16FromDiscord<Yardanico> the latter
20:56:21FromDiscord<zetashift> ah yea
20:56:47FromDiscord<Yardanico> that's how you usually write types for inheritance and dynamic dispatch
20:56:52FromDiscord<zetashift> In reply to @Kiloneie "if i were to": It's fine for a beginner video I wouldn't sweat it, maybe you could add a note in the description, but I was just curious
20:56:55FromDiscord<Kiloneie> I am curious though if anyone is reading trough the documentation/offline tutorial i have provided with these last 2 videos... i no longer use OneNote to do video script, i can now much easily transition to Linux, though gaming is still a bummer.
20:57:31FromDiscord<Yardanico> gaming as in what games?
20:57:35FromDiscord<Kiloneie> Honestly just leaving it in is fine, nobody will run into any problems
20:57:49FromDiscord<Kiloneie> well most games i tried with proton didn't work...
20:57:56FromDiscord<Yardanico> That's extremely weird
20:58:15FromDiscord<zetashift> In reply to @Yardanico "that's how you usually": Ah alright, I see inheritance used from time to time in Nim game engines but whenever I write code I try to avoid it
20:58:25FromDiscord<zetashift> Is there any reason you opted in for inheritance for images and walls?
20:58:27FromDiscord<Kiloneie> even Heroes of the storm which says GOLD, will never ever stop lagging like hell and keeping really low fps on my freaking 1070 ti which is overkill for that game.
20:58:48ForumUpdaterBotNew thread by DavidKunz: Missing Symmetry: varargs vs. all, see https://forum.nim-lang.org/t/7644
20:59:19FromDiscord<Kiloneie> i was experimenting with inheritance when doing the video, but eventually it just stayed there for no good reason.
20:59:45FromDiscord<Kiloneie> the restructuring part of #2 that made it into the video because it was very unorganized before and sloppy
20:59:53FromDiscord<zetashift> Alright I get that, I like the video tho 😄
21:00:29FromDiscord<Kiloneie> I should be doing more drawing/animation for my videos though, this one is the first with any kind of drawing
21:00:57FromDiscord<Kiloneie> im not sure how that guy who explains physics and science of movies and games does it
21:01:05FromDiscord<Kiloneie> i think he has some kind of drawing board but...
21:01:31FromDiscord<Kiloneie> Let me find the dude
21:01:49FromDiscord<Kiloneie> Because Science
21:02:49ForumUpdaterBotNew thread by Akavel: Weird error between sequtils and nim-result, see https://forum.nim-lang.org/t/7645
21:09:22FromDiscord<Kiloneie> Also fun fact, when i was trying to explain the horizontal wall placement in this last #2 video, forgot a variable change like several times in a row, resulting in 30 min spent of re recording D:
21:09:42FromDiscord<Kiloneie> All was fine till SDL shown me a white window xD
21:25:36*Guest94576 quit (Quit: Guest94576)
21:30:34*vicfred quit (Quit: Leaving)
21:45:08*Vladar quit (Quit: Leaving)
21:50:23*xet7 quit (Quit: Leaving)
21:51:34*xet7 joined #nim
22:10:17FromDiscord<Kiloneie> I saw a post about esp32 on forum, is that a microntroller i should make a video about? Idk which to get.
22:10:31FromDiscord<ElegantBeef> Yea that's a micro controller
22:12:58FromDiscord<Kiloneie> Now where to buy one xD...
22:13:41FromDiscord<Kiloneie> the DEV kit one ? https://www.arissi.eu/esp32/
22:14:23FromDiscord<Kiloneie> Wait one has a screen on it D:
22:15:53FromDiscord<ElegantBeef> Could also get a pico, though i've just started making bindings for it
22:17:02FromDiscord<Kiloneie> The things imma do with one is probably, take pictures, wifi messaging/bluetooth, games 😛
22:17:59FromDiscord<ElegantBeef> Yea and the pico is capable of all that(I really just want more people to test my setup as i develop it) 😛
22:18:19FromDiscord<Kiloneie> Hah, maybe i will get one of those
22:18:32FromDiscord<Kiloneie> Idk gotta ask dom some more one of these days
22:18:54FromDiscord<Kiloneie> Cause i have no clue in microcontrollers past some foggy memory of arduino from highschool
22:19:12FromDiscord<Kiloneie> Maybe i can make something useful for myself.
22:19:25FromDiscord<Kiloneie> A mouse clicker would be dope xD
22:19:38FromDiscord<Valor> pico as in nico?
22:19:48FromDiscord<ElegantBeef> Well the pico can be a usb host device, so can be speakers, or mouse or keyboard
22:19:53FromDiscord<ElegantBeef> Nah raspberry pi pico
22:25:51*a_b_m joined #nim
22:35:02FromDiscord<dom96> I've recently learned that it's best to avoid `seq` when serializing/deserialising data on the ESP32 🙂
22:35:25*abm quit (*.net *.split)
22:35:26*tane quit (*.net *.split)
22:35:27FromDiscord<dom96> and my plan to play small GIFs seems needs a rethought
22:35:38*zopsi quit (Max SendQ exceeded)
22:36:01*zopsi joined #nim
22:42:26FromDiscord<ElegantBeef> Are these gives stored in memory?
22:42:30FromDiscord<ElegantBeef> (edit) "gives" => "gifs"
22:42:59*tane joined #nim
22:43:54FromDiscord<ElegantBeef> (edit) "memory?" => "memory at compile time?"
22:49:20*tane quit (Quit: Leaving)
23:09:08FromDiscord<dom96> @ElegantBeef nope, they're serve via HTTP. The ESP connects to a server and requests what it should display.
23:09:12FromDiscord<dom96> (edit) "serve" => "served"
23:09:15FromDiscord<ElegantBeef> Ah
23:21:52FromDiscord<mario2> In reply to @txtincome "Are static analyzers like": I want to expand what this guy asked. Would something like lint even be needed if working with nim?
23:23:20FromDiscord<ElegantBeef> nimcheck is what is typically used at edit time to see the validity of the code
23:25:38FromDiscord<mario2> I can't find nimcheck in the documentation.
23:25:43FromDiscord<ElegantBeef> sorry it's `nim check`
23:25:50FromDiscord<ElegantBeef> https://nim-lang.org/docs/nimc.html
23:26:09FromDiscord<ElegantBeef> A compiler option that semantically checks the nim code reporting any error(s)
23:26:27FromDiscord<mario2> What about the C or C++ code?
23:30:29FromDiscord<ElegantBeef> Well with the json file you should be able to tell an editor what files are being compiled and then link it all
23:31:26FromDiscord<ElegantBeef> I've not ever needed to look at the C code aside from porting the pico sdk, though this is the only time i've done C interop
23:33:27FromDiscord<Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2T70
23:33:46FromDiscord<Livingstone> what do you guys think about this turning a csvparser into a datatset
23:36:29FromDiscord<mario2> Is there a way I can write #include <name> and have nim know I want to import a package with that name?
23:37:25FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma
23:37:46FromDiscord<ElegantBeef> @Livingstone cmon use `s.isNil` 😛
23:38:18FromGitter<ynfle> Nim comes top other than unix tools for the unoptimized version here! https://benhoyt.com/writings/count-words/#performance-results-and-learnings
23:39:00FromDiscord<mario2> @ElegantBeef Can I rewrite that example as similar to other languages?
23:39:10FromDiscord<ElegantBeef> @Livingstone Here you go https://play.nim-lang.org/#ix=2T74
23:39:15FromDiscord<ElegantBeef> What do you mean mario?
23:39:48FromDiscord<ElegantBeef> Remember Nim uses a C backend so can include that C code directly
23:40:04FromDiscord<ElegantBeef> If you want to use dynamic loaded libraries checkout the `dynlib` module
23:41:35FromDiscord<mario2> I was thinking of importing packages with another shebang. Like #!/location/of/package or #! <package name>. Around the lines of that. Just place it at the top of the file to import said package.
23:42:13FromDiscord<ElegantBeef> Oh if you just want to import a file and dont want to interop with it you can just do↵`{.emit: """#include "yourHeaderFile.h"""".}`
23:42:55FromDiscord<ElegantBeef> emit will as the name implies emit the string into the source code of the backend
23:43:12FromDiscord<ElegantBeef> So you can use it for writting C/C++ or even JS code inside your nim files
23:43:40FromDiscord<mario2> What if I want to define a different means of importing a package.
23:43:54FromDiscord<ElegantBeef> What do you mean?
23:44:18FromDiscord<mario2> I said this morning I want to make a language on top of nim. I just want to make a means of important not header files.
23:44:28FromDiscord<ElegantBeef> If you dont want that emit but want `#! "yourheaderfile.h"`?
23:44:38FromDiscord<mario2> So emit is the way?
23:44:49FromDiscord<ElegantBeef> Well emit outputs code into the C file
23:45:13FromDiscord<ElegantBeef> So you can write any C code there and it'll be compiled along side your project
23:45:24FromDiscord<mario2> I don't think I'm clear. I want a means of important a different file other than header files or .nim files into my projects.
23:45:38FromDiscord<ElegantBeef> Ok so you want to include different source files
23:45:48FromDiscord<ElegantBeef> `staticRead` will let you load files into memory
23:46:09FromDiscord<ElegantBeef> Useful for embedding assets and the like into programs
23:46:25FromDiscord<mario2> Can I use type or template or macro to define how staticRead imports the file?
23:46:44FromDiscord<ElegantBeef> Well it'll read the file and return a string, so then you can process that at CTE
23:46:47FromDiscord<ElegantBeef> (edit) "CTE" => "CT"
23:47:28FromDiscord<ElegantBeef> Like for instance i use that for loading levels/tutorials in my game https://media.discordapp.net/attachments/371759389889003532/821530136498798633/unknown.png
23:47:34FromDiscord<ElegantBeef> I still dont know if this is what you mean
23:47:49FromDiscord<mario2> Let me give you an example. Give me a second.
23:49:14FromDiscord<mario2> sent a code paste, see https://play.nim-lang.org/#ix=2T76
23:49:35FromDiscord<ElegantBeef> And what would those files do?
23:49:57FromDiscord<mario2> They would contain my source code. I said I was building a language on top of nim.
23:50:34FromDiscord<ElegantBeef> So these would be statically loaded files that would be expanded into nim code by the `#! macro`?
23:51:09FromDiscord<ElegantBeef> if that's the goal then yea a macro should be able to run over the file given a path, and expand it into nim code to be compiled
23:51:44FromDiscord<mario2> Then how do I say "HEY NIM! IMPORT THIS PACKAGE!" when I type #! at the top?
23:51:51FromDiscord<ElegantBeef> A macro
23:51:52FromDiscord<mario2> Or rather how do I get nim to understand it?
23:51:56FromDiscord<mario2> Thank you.
23:52:24FromDiscord<ElegantBeef> The macro would read the file and parse it into the equivlent nim code, that then emits it out to be compiled
23:53:19FromDiscord<ElegantBeef> To see this in action you could use `readFile` inside the macro and then `parseStmt` on that string which would let you atleast use Nim code in a seperate non .nim file
23:54:37FromDiscord<mario2> This can work. The language on top of nim would transpile my source code to be made into nim code to be compiled.