<< 03-08-2021 >>

00:06:00*bkay quit (Quit: Leaving)
00:21:24FromDiscord<@bracketmaster-5a708063d73408ce4> why is nim packaged with both nre and re, both of which a wrappers around pcre?
00:22:04FromDiscord<Elegantbeef> legacy support + lack of a way to nicely remove packages from the stdlib
00:22:19FromDiscord<@bracketmaster-5a708063d73408ce4> which one is legacy?
00:22:32FromDiscord<Elegantbeef> I dont know i just suggest using `nim-regex` from nimble
00:22:49FromDiscord<@bracketmaster-5a708063d73408ce4> I don't like nim-regex
00:22:54FromDiscord<@bracketmaster-5a708063d73408ce4> it wasn't working for me
00:23:08FromDiscord<@bracketmaster-5a708063d73408ce4> match("hello my world", re"hello\|world.\", matches\_found)
00:23:13FromDiscord<@bracketmaster-5a708063d73408ce4> that's nim-regex
00:23:18FromDiscord<@bracketmaster-5a708063d73408ce4> and it returns false
00:23:19FromDiscord<Rika> re is the "legacy" but nre is the lesser used
00:23:37FromDiscord<Rika> In reply to @@bracketmaster-5a708063d73408ce4 "match("hello my world", re"hello\|world.\*",": this is wrong
00:23:40FromDiscord<Rika> is it not?
00:23:45FromDiscord<Elegantbeef> Seems like it's less of "not liking it" and it just not working for you \:D
00:23:55FromDiscord<Rika> your regex is wrong is what i mean
00:24:12FromDiscord<@bracketmaster-5a708063d73408ce4> is it?
00:24:12FromDiscord<@bracketmaster-5a708063d73408ce4> https://regex101.com
00:24:19FromDiscord<Rika> ah, no its not
00:24:53FromDiscord<Rika> different perception of precedence
00:26:21FromDiscord<Rika> !eval import regex; match("hello my world", re"hello|world.")
00:26:24NimBotCompile failed: /usercode/in.nim(1, 20) Error: expression 'match("hello my world", re"hello|world.")' is of type 'bool' and has to be used (or discarded)
00:26:24FromDiscord<Rika> fuck
00:26:26FromDiscord<Rika> didnt echo
00:26:30FromDiscord<Rika> !eval import regex; echo match("hello my world", re"hello|world.")
00:26:36NimBotfalse
00:26:50FromDiscord<Rika> ah
00:26:53FromDiscord<Rika> its because of the .
00:27:15FromDiscord<Rika> i assume
00:27:18FromDiscord<Rika> !eval import regex; echo match("hello my world", re"hello|world")
00:27:24NimBotfalse
00:27:40FromDiscord<Rika> might be a faulty implementation of | then
00:27:44FromDiscord<konsumlamm> my guess is that it's because of matching the whole string vs somewhere in it
00:27:49FromDiscord<Rika> !eval import regex; echo match("hello my world", re"(hello)|(world)")
00:27:54NimBotfalse
00:28:01FromDiscord<konsumlamm> i.e. it just has different behaviour, by deisgn
00:28:18FromDiscord<Rika> oh
00:28:27FromDiscord<Rika> `match` only works if the whole string matches
00:28:36thunder!eval import regex; echo match("hello my world", re"(hello|world)")
00:28:41NimBotfalse
00:28:48FromDiscord<Rika> !eval import regex; echo find("hello my world", re"hello|world.")
00:28:50NimBotCompile failed: /playground/nim/lib/system.nim(1806, 10) Error: type mismatch: got <char, Regex>
00:29:04FromDiscord<Rika> i mean findAll
00:29:11FromDiscord<Rika> !eval import regex; echo findAll("hello my world", re"hello|world.")
00:29:16NimBot@[(captures: @[], namedGroups: (data: @[], counter: 0, first: 0, last: 0), boundaries: 0 .. 4)]
00:29:38FromDiscord<Rika> it only captured one
00:29:40FromDiscord<Rika> odd
00:30:17thunder"world." would tmk match the world world followed by any char. but if there is no char after world, then no match
00:30:25thunder*word world
00:30:41FromDiscord<Rika> there is a
00:30:48FromDiscord<Rika> did the bridge destroy the fucking asteisk
00:30:50FromDiscord<Rika> (edit) "asteisk" => "asterisk"
00:30:57thunderyeah
00:31:01FromDiscord<Rika> great
00:31:11FromDiscord<Rika> !eval import regex; echo findAll("hello my world", re"hello|world.\")
00:31:13FromDiscord<Rika> how about now
00:31:16thundernope
00:31:17NimBot@[(captures: @[], namedGroups: (data: @[], counter: 0, first: 0, last: 0), boundaries: 0 .. 4)]
00:31:24thunderasterisk was nuked
00:31:25FromDiscord<Rika> you try it
00:31:32FromDiscord<Rika> just copy but add the asterisk lmao
00:31:36FromDiscord<Rika> should work then
00:31:39FromDiscord<@bracketmaster-5a708063d73408ce4> @\_discord\_259277943275126785\:t2bot.io , I see the astericks
00:31:45thunder !eval import regex; echo findAll("hello my world", re"hello|world.\*")
00:31:50FromDiscord<Rika> matrix goes through a different bridge
00:31:56thunder!eval import regex; echo findAll("hello my world", re"hello|world.\*")
00:32:03NimBot@[(captures: @[], namedGroups: (data: @[], counter: 0, first: 0, last: 0), boundaries: 0 .. 4)]
00:32:18*happycorsair[m] quit (Read error: Connection reset by peer)
00:32:22*Helios quit (Read error: Connection reset by peer)
00:32:22*nixfreak_nim[m] quit (Read error: Connection reset by peer)
00:32:22*thunder shrugs
00:32:22FromDiscord<Rika> still one 🤔
00:34:06*nixfreak_nim[m] joined #nim
00:34:55FromDiscord<Rika> know that by using re or nre you will need to have pcre either packaged or installed in the runner's system
00:34:55*Helios joined #nim
00:34:56*happycorsair[m] joined #nim
00:35:05FromDiscord<Rika> and it will not have the same runtime guarantees as reges
00:35:06FromDiscord<Rika> (edit) "reges" => "regex"
00:42:02FromDiscord<sunsilk> #ask I want to ask if there is a requests library in python, what about nim?
00:42:32FromDiscord<Rika> httpclient
01:03:43*Guest12 joined #nim
01:10:01*Guest12 quit (Ping timeout: 246 seconds)
01:36:42*auxym quit (Ping timeout: 256 seconds)
02:03:42*arkurious quit (Quit: Leaving)
02:28:02*xet7 quit (Ping timeout: 258 seconds)
02:31:13*krux02 quit (Remote host closed the connection)
02:37:02*rockcavera quit (Remote host closed the connection)
02:39:21*xet7 joined #nim
03:33:53FromDiscord<bolino> sent a long message, see http://ix.io/3uQB
03:34:10FromDiscord<bolino> (edit) "http://ix.io/3uQB" => "http://ix.io/3uQC"
04:06:01*supakeen quit (Quit: WeeChat 3.2)
04:06:34*supakeen joined #nim
04:12:48FromDiscord<bolino> In reply to @bolino "Hi there! I'm executing": .. I mean of course I can do that, but is there a more efficient way to directly get the response as strings list, or to convert it?↵`var strings = newSeq[string]()↵for r in rows:↵ strings.add(r[0])`
04:31:54FromDiscord<Elegantbeef> @bolino\: Row is a `seq[string]`
04:32:06FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-4/lib/impure/db_mysql.nim#L95
04:32:29FromDiscord<Elegantbeef> Assuming using the mysql library from the stdlib
05:06:28*icebattle quit (*.net *.split)
05:06:28*cornfeedhobo quit (*.net *.split)
05:06:28*mjsir911 quit (*.net *.split)
05:06:35*icebattle joined #nim
05:06:39*mjsir911 joined #nim
05:06:49*mjsir911 quit (Changing host)
05:06:49*mjsir911 joined #nim
05:13:51*cornfeedhobo joined #nim
05:21:48FromDiscord<bolino> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/blob/version-1-4/li": Yes exactly! And yes, using standard mysql lib. So there's not more elegant solution than looping over like I'm doing?
05:22:41FromDiscord<Elegantbeef> well since it's a row you can do `.seq` or `seq[string](yourRow)` no?
05:24:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3uQW
05:29:39FromDiscord<Elegantbeef> Also worth noting `sugar.collect` and `sequtils.toSeq` are both better methods to what your first suggestion was @bolino
05:31:48FromDiscord<Elegantbeef> \now noticing that it's a `seq[Row]` and i assume you want a single `seq[string]`
05:38:45FromDiscord<bolino> > now noticing that it's a seq[Row] and i assume you want a single seq[string]
05:38:51FromDiscord<bolino> (edit) "seq[string]" => "seq[string]↵exactly"
05:39:28FromDiscord<bolino> In reply to @Elegantbeef "\*now noticing that it's": exactly
05:42:42FromDiscord<Elegantbeef> then afaik yea best way of handling it
05:46:07FromDiscord<Rika> Nice
05:57:38FromDiscord<bolino> In reply to @Elegantbeef "then afaik yea best": I'm slightly confused - your solutions show how to convert a single row to a sequence of strings, but I'm looking at how to convert a sequence of multiple rows (with each one having a single string) to a sequence of strings
05:57:42FromDiscord<bolino> does that make sense?
05:58:10FromDiscord<Elegantbeef> Like i said use your method or collect
06:00:01FromDiscord<bolino> In reply to @Elegantbeef "Like i said use": Okaye, gotcha
06:00:04FromDiscord<bolino> thanks!
06:07:10FromDiscord<bolino> Didn't know about collect. So FYI, applied to my question, this works:↵`let strings = collect(newSeq):↵ for r in rows: r[0]`
06:07:45FromDiscord<bolino> (edit) "Didn't know about collect. So FYI, applied to my question, ... thisr[0]`↵(looks" added "thanks to @ElegantBeef" | "r[0]`" => "r[0]`↵(looks better than my initial loop)"
06:08:01FromDiscord<bolino> (edit) "collect." => "`collect`."
07:10:56*max22- joined #nim
07:13:53*maxime_ joined #nim
07:16:47*max22- quit (Ping timeout: 245 seconds)
07:22:36arkanoidI'm going to try to create my first project heavily based on nim metaprogramming. But first I'd like to ask a suggestion to you
07:23:21arkanoidI want to implement a library that reads .wsdl files (SOAP) and creates the nim interface for that web service. That mean types and procs
07:24:18arkanoidquestion it: is it better to create a project that actually write to disk nim files generated from wsdl parsing, or is better to load wsdl at runtime and generate procs
07:24:36arkanoidI mean without writing .nim files
07:25:23FromDiscord<Rika> Generate proc at runtime?
07:33:25FromDiscord<Elegantbeef> To give a more concise answer nim's metaprogramming is only accessible at compile time, you cannot use it at runtime, so the way to do it is the former, but you dont need to save the macro output to a file since macros expand in place
07:34:17FromDiscord<Rika> But it will generate the code every time you compile
07:34:20FromDiscord<Rika> Which may be slow
07:34:33FromDiscord<Rika> Saving to another file may be better depending on your opinion
07:45:47arkanoidRika, yeah you got it right. I was thinking about expanding macros at compilation time instead of generating a tool that given a wsdl file generates a dir of nim modules
07:46:12arkanoidprobably there's not much difference between the two
07:46:31FromDiscord<Rika> Well as I’ve said it may cause a compile time length difference
07:47:05FromDiscord<Elegantbeef> The main difference would just be a flag or something similar to tell it to poop it out to a nim file/include
07:59:06arkanoidI've another question. I will need to heavily test my code, and this mean dividing logic in multiple funcs to be used within a macro. Do you suggest writing a lot of macros and call them in tests, or write nim procs that returns NimNode instead and call them from test and macros?
08:03:52FromDiscord<Rika> What?
08:04:10FromDiscord<Rika> Ah you mean testing the macro logic?
08:04:43FromDiscord<Rika> I would do the proc one but your choice I think
08:08:15arkanoidI do agree with staying in the proc world as long as possible
08:09:24*maxime_ quit (Ping timeout: 256 seconds)
08:10:53*max22- joined #nim
08:21:57FromDiscord<Rika> No I just think making many macros is repetition
09:08:22*maxime_ joined #nim
09:11:05*max22- quit (Ping timeout: 250 seconds)
09:44:33arkanoiddo you think is possible to parse xml at compile time?
09:48:06arkanoidXmlNode cannot be const :(
09:48:29arkanoidthis makes the "read wsdl and build interface at compile time" impossible
09:49:02arkanoidI need read wsdl at runtime, generate the required nim code and write files to disk
09:49:19arkanoidso not even macro are usable, only runtime code
09:49:30arkanoidbasically I've to write nim code with strings?
09:51:53emeryarkanoid: I think you can parse XML at compile-time, but you can't compile a const XmlNode, so you need to copy the data from XmlNode to another representation
09:53:06arkanoidcan I use ref types at compile time?
09:54:02emeryI don't think so, but you can have containers holding objects
09:54:34arkanoidk, ,let's try
09:55:18arkanoidI'm also having difficultis with staticRead/slup, it's not finding files. I'm using nim from choosenim, is it searching them in nim binary path?
09:57:15arkanoidos.currentSourcePath returns my project path correctly
10:07:45arkanoidsolved with getProjectPath
10:08:02arkanoidthe xml schema parsing works at compile time! yeah!
10:09:11arkanoidwhat's the signature of a function that takes a string and returns a type definition? like "xs:string" -> string
10:11:29arkanoidI'm doing "func toTypedesc(xsType: string): typedesc =" but I'n the contained case expression I' getting like "of "expression 'bool' is of type 'type bool' and has to be used (or discarded)"
10:17:32arkanoidoh, wait, I've just realised that I have to use "return" in this case. Non sure why, but seems that here case is used as statement and not expression
10:29:26FromDiscord<Rika> In reply to @arkanoid "can I use ref": not deeply nested ref
10:29:52FromDiscord<Rika> so you can have a seq to a regular object, but a seq to a ref is prolly not ok
10:33:40FromDiscord<ynfle (ynfle)> https://play.nim-lang.org/#ix=3uSe Is this a bug?
10:43:02arkanoidRika, I'm doing xmlparse.parseXml that returns a deeply nested XmlNode tree where XmlNode = ref XmlNodeObj, but it seems working
10:47:40*xet7 quit (Remote host closed the connection)
10:48:32*xet7 joined #nim
10:48:50*xet7 quit (Remote host closed the connection)
11:09:10*xet7 joined #nim
11:10:10FromDiscord<haxscramper> no, `x: NimNode` is a procedure argument
11:10:13FromDiscord<haxscramper> So it is not accessible at compile-time
11:10:14*xet7 quit (Remote host closed the connection)
11:10:33FromDiscord<haxscramper> In order for this to work you need argument to be `static[]`
11:50:48*xet7 joined #nim
11:53:18*Freneticks quit (Ping timeout: 252 seconds)
12:04:31*thunder quit (Remote host closed the connection)
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:34*supakeen joined #nim
12:07:02*maxime_ quit (Ping timeout: 252 seconds)
12:13:44arkanoidcan you help me spot where the error is here? https://play.nim-lang.org/#ix=3uSx
12:20:11arkanoidI really don't see how's possible that a rangedefect can be raised from that code
12:24:03arkanoidthe ast generation code is coming straight from dumpAstGen, I've just splitted it in macro and funcs. If I keep it into one single block it works
12:36:58arkanoidthis is the best solution I've found, yet I'm failing in parametrizing genTypeSection macro
12:37:44arkanoidI've tried them all: static[openArray[NimNode]], static[varargs[NimNode]], ...
12:40:23arkanoidif fails (SIGSEGV) even if I give up trying passing a sequence of NimNode and pass 2 NimNode as argument instead: https://play.nim-lang.org/#ix=3uSG
12:44:13*neceve joined #nim
12:44:52arkanoidso the question is, can I pass NimNode arguments to a macro?
12:51:25federico3isn't this syntax a bit too verbose? raise newException(SomethingError, "...")
12:52:16FromDiscord<Rika> there is another `raise (ref SomethingError)(message: "...")` that some prefer
12:53:08FromDiscord<Rika> honestly i do not know why exceptions are not internally `ref` and you have to do this odd construction syntax instead of `SE(msg: ...)`
12:56:40FromDiscord<haxscramper> You can make exception a ref object of
12:57:10FromDiscord<haxscramper> But then it will complain when someone tries to raise it via new exception
12:57:47FromDiscord<haxscramper> But I prefer to just write normal constructor, in a lot of cases it makes things easier
12:58:56FromDiscord<Rika> yes i know you can
13:04:29FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=3uSO
13:05:07FromDiscord<deech> I downloaded `fusion` and the `matching` tests pass so I don't think the problem is the library.
13:06:31*krux02 joined #nim
13:07:28FromDiscord<deech> Seems to work fine in the playground and on my Linux machines: https://play.nim-lang.org/#ix=3uSQ
13:10:20*arkurious joined #nim
13:10:35arkanoidI'd consider the long exception raise expression as a suggestion to use Option and monads instead :P
13:10:59FromDiscord<Rika> now you have a tonne of `isNone` `none()` `some()`
13:11:02FromDiscord<Rika> xd
13:11:23FromDiscord<Rika> oh dont forget `get` even after `isNone`
13:11:38FromDiscord<Rika> i mean `isSome` i guess
13:12:46arkanoidnot needed when using flatMap and friends!
13:13:44*rockcavera joined #nim
13:13:44*rockcavera quit (Changing host)
13:13:44*rockcavera joined #nim
13:22:50FromDiscord<deech> nm works now. Had to do a `build_all.sh` because I hadn't pulled since Nim froze a new version of the C sources so the compiler still reported that it was `1.5.1` but internally hadn't switched to `case` from `match` for `caseStmtMacros`. The solution was to blow away the `Nim` repo and rebuild from scratch.
13:23:30FromDiscord<Rika> In reply to @arkanoid "not needed when using": i guess that simplifies it quite a bit `opt.flatMap() do (...) -> Option[...]: ...`
13:24:05arkanoidnot yet used to "do" syntax, actually I don't find it sexy
13:24:14FromDiscord<Rika> to each their own
13:28:25FromDiscord<Clonkk> What does `Error: system module needs: nimGCvisit` means ?
13:28:50FromDiscord<Rika> your platform does not implement some stuff that system needs
13:29:07FromDiscord<Rika> are you using embedded platforms or something that isnt linux/macos/windows/bsd?
13:29:19FromDiscord<Clonkk> Plair Linux x84\_64↵(@Rika)
13:29:35FromDiscord<Clonkk> OpenSuse, so it's pretty vanilla
13:29:40FromDiscord<@bracketmaster-5a708063d73408ce4> treeform/print basically prints out a nim structure
13:29:49FromDiscord<haxscramper> i got this error when one `.cfg` specified `--gc:orc` and other (in the parent directory) `--gc:refc`
13:29:55FromDiscord<Rika> thats weird wtf
13:30:00FromDiscord<@bracketmaster-5a708063d73408ce4> is there a way to write treeform/print output to a file instead of to stdout?
13:30:14FromDiscord<@bracketmaster-5a708063d73408ce4> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/872108962919624724): treeform/print basically prints out valid nim code
13:30:14FromDiscord<Clonkk> Ah↵(@haxscramper)
13:30:17FromDiscord<Clonkk> Well
13:30:17FromDiscord<Clonkk> Yeah
13:30:19FromDiscord<Clonkk> Probably
13:30:27FromDiscord<Clonkk> Thought commandLine override confuig file ?
13:31:47FromDiscord<Clonkk> So if oyu use --gc\:refc on commandLine and you have --gc\:orc in a config file yo ucan't compile
13:31:48FromDiscord<Clonkk> ?
13:32:04FromDiscord<Clonkk> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/872109495088709662): So if oyu use --gc\:refc on command line and you have --gc\:orc in a config file yo ucan't compile
13:32:28FromDiscord<haxscramper> https://github.com/treeform/print/blob/master/src/print.nim#L239 no, it seems hardcoded
13:33:40FromDiscord<Clonkk> You can always capture stdout output
13:33:48*nrds joined #nim
13:37:33FromDiscord<DeathByRebellion> I remember WipEout. That was such an awesome racing game
13:39:24FromDiscord<DeathByRebellion> Anyways
13:39:34FromDiscord<DeathByRebellion> What are you guys talking about?
13:39:48FromDiscord<DeathByRebellion> I need to practice Nim Programming. What's the best way to do so?
13:40:00FromDiscord<DeathByRebellion> I can't come up with any ideas that aren't behind my skill level
13:40:10FromDiscord<@bracketmaster-5a708063d73408ce4> Nice name
13:40:24FromDiscord<@bracketmaster-5a708063d73408ce4> Write a C- compiler?
13:40:37FromDiscord<@bracketmaster-5a708063d73408ce4> Write a static website server?
13:40:48FromDiscord<@bracketmaster-5a708063d73408ce4> Write a discord implementation not based on electron?
13:41:06FromDiscord<@bracketmaster-5a708063d73408ce4> Write a slack implementation not based on electron? With cimgui bindings?
13:41:43nrds<Prestige99> Or maybe something simpler like an irc bot
13:41:53FromDiscord<@bracketmaster-5a708063d73408ce4> Note that that was "C-" not C
13:42:01FromDiscord<@bracketmaster-5a708063d73408ce4> C- is pretty simple
13:42:10FromDiscord<Clonkk> YOu have https://exercism.io/ or you can always do some simple stuff that have already been done. Personnally I like to implement https://www.foaas.com/
13:47:19federico3 DeathByRebellion a multi-protocol IM client please :)
13:49:12FromDiscord<@bracketmaster-5a708063d73408ce4> yeah - that'd be nice
13:49:15FromDiscord<@bracketmaster-5a708063d73408ce4> something I might even pay for
13:49:23FromDiscord<@bracketmaster-5a708063d73408ce4> As long as it doesn't take up 1GB of ram
13:50:36FromDiscord<@bracketmaster-5a708063d73408ce4> opening slack and discord eats up 2 out of my measly 8GB of ram
13:50:53FromDiscord<@bracketmaster-5a708063d73408ce4> spotify makes for 3GB
13:50:57FromDiscord<Clonkk> Anything with a GUI is going to be a PITA to do for a side project
13:51:21FromDiscord<@bracketmaster-5a708063d73408ce4> Well - it will take dedication - Cimgui is not so bad
13:51:53FromDiscord<Clonkk> Enable notification by email / on your phone. Go on the desktop app / website version only when notified
13:52:39FromDiscord<@bracketmaster-5a708063d73408ce4> or just build something better 😛
13:53:19FromDiscord<@bracketmaster-5a708063d73408ce4> My iMac G3 with 64MBs of ram could do multiple chat apps and listen to music at the same time back in its day
13:53:26FromDiscord<@bracketmaster-5a708063d73408ce4> There's really no excuse
13:53:33FromDiscord<virdisn> https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers lists [x] dependent types. Where can I find examples / it's documentation ?
13:54:09FromDiscord<haxscramper> 30mb for discord
13:54:09FromDiscord<haxscramper> Why can'y you people just open discord in browser?
13:54:10FromDiscord<haxscramper> done
13:54:14FromDiscord<Clonkk> 👍️
13:54:23FromDiscord<@bracketmaster-5a708063d73408ce4> check your CPU usage for discord in browser
13:54:28FromDiscord<@bracketmaster-5a708063d73408ce4> tell me what you find
13:56:05FromDiscord<@bracketmaster-5a708063d73408ce4> Discord in safari shows up at 500MB
13:56:22FromDiscord<DeathByRebellion> I've never heard of C- in my entire life
13:56:35FromDiscord<Clonkk> At the moment, my discord tab uses ~280 MB (after having clicked on every server I had)
13:56:38FromDiscord<carmysilna> might be talking about ghc's cmm
13:56:39FromDiscord<Clonkk> Not that bad
13:57:07FromDiscord<@bracketmaster-5a708063d73408ce4> 280MB is absolutely nuts!!
13:57:15FromDiscord<@bracketmaster-5a708063d73408ce4> The english bible is 5MB
13:57:28FromDiscord<haxscramper> Firefox reports discord tab memory usage at 31.6mb, and cpu usage as "low, 0.7"
13:57:58FromDiscord<@bracketmaster-5a708063d73408ce4> lemme try firefox
13:58:45FromDiscord<haxscramper> In reply to @virdisn "https://github.com/nim-lang/Nim/wiki/Nim-for-TypeSc": I don't know what exactly they mean by "dependent types"
13:58:57FromDiscord<haxscramper> but assuming something like idris - we don't have anything of that sort
13:59:16FromDiscord<Clonkk> You're comparing a dynamic web page with a static content...
13:59:32FromDiscord<Clonkk> I'm on Firefox too, have a dozen of server. Tried to click on each of them so I'm not in an idle state
13:59:56FromDiscord<@bracketmaster-5a708063d73408ce4> Firefox isn't adding up
14:00:10FromDiscord<@bracketmaster-5a708063d73408ce4> So activity monitor shows a total of 700Mb for firefox
14:00:15FromDiscord<@bracketmaster-5a708063d73408ce4> but only 11MB for discord
14:00:27FromDiscord<@bracketmaster-5a708063d73408ce4> I only have discord open in Firefox
14:00:52FromDiscord<@bracketmaster-5a708063d73408ce4> That is, firefox task manager shows only 11mb for discord
14:00:53FromDiscord<Clonkk> Activity Monitor can lie to you
14:01:11FromDiscord<Clonkk> Because some process expects to uses a lot of RAM so they pre-allocate RAM that isn't actually use
14:01:34FromDiscord<Clonkk> It's like VIRT and RES on Linux when you top
14:02:13FromDiscord<Clonkk> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/872116890883997696): Because some process expects to uses a lot of RAM so they pre-allocate RAM that isn't actually used
14:02:35FromDiscord<virdisn> @haxscramper https://github.com/nim-lang/Nim/issues/18639 🙂
14:02:38federico3I wouldn't need a client. Anything that can act as Quassel or weechat (not wechat) server would do
14:03:34FromDiscord<@bracketmaster-5a708063d73408ce4> true
14:04:18FromDiscord<haxscramper> In reply to @virdisn "<@!608382355454951435> https://github.com/nim-lang/": This page was most likely written by `@juancarlospaco`, so maybe there is something of that sort, of the wording is not fully correct
14:04:31FromDiscord<haxscramper> It's a shame github wiki does not have "git blame" support
14:07:25nrds<Prestige99> can't clone it as a repo?
14:10:08FromDiscord<haxscramper> yes, I forgot about that
14:10:17FromDiscord<haxscramper> and yes, it was authored by @juan_carlos
14:24:23FromDiscord<Clonkk> Is there any Nim lib to press a key / move your mouse by code on Linux ?
14:24:30arkanoiddo you know if it's possible to curl/download a file at compile time?
14:25:34FromDiscord<@bracketmaster-5a708063d73408ce4> I don't see why you couldn't call curl in a static block
14:26:11FromDiscord<Clonkk> You can call a CLI program at compile time with `gorge` / `staticExec`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
14:28:10FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3uT7
14:32:34*[R] quit (Ping timeout: 240 seconds)
14:36:22FromDiscord<gogolxdong (liuxiaodong)> Anyone knows `Could not download: No SSL/TLS CA certificates found.`?
14:38:45FromDiscord<ajusa> In reply to @ajusa "Anyone know how I": Fixed it, gave up and just statically compiled everything
15:02:26*ggt1 joined #nim
15:08:40arkanoidClonkk thanks!
15:14:35ggt1in a template, how to have an underscore when creating an identifier with backticks?
15:14:52ggt1somthing like this `prefix_ variable`
15:15:32ggt1nim complains about trailing underscore
15:17:57ggt1usecase: https://play.nim-lang.org/#ix=3uTx
15:28:48FromDiscord<Rika> i do not see any trailing underscore errors in your use case
15:29:45FromDiscord<Rika> nonetheless, just remove the trailing underscore. its not required
15:29:53FromDiscord<Rika> so `e y` will work
15:29:55ggt1oh, I missed a space. `e.e_ y`
15:31:36FromDiscord<Rika> either "echo e.`e y`" or "echo `e y`" will work
15:33:01ggt1"echo e.`e y`" was what I need, thx
15:33:22ggt1still this works because a_b and ab are the same identifiers in nim
15:33:35FromDiscord<Rika> yes
15:33:36ggt1but it is not possible to create a_b in the template
15:33:43FromDiscord<Rika> it does not matter
15:34:05ggt1if I try to print the id as string with a astToStr for example
15:34:11ggt1it will be without an undescore
15:34:18FromDiscord<Rika> lets see
15:34:39FromDiscord<Rika> how do you print it
15:41:04*liblq-dev joined #nim
15:45:36*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
15:46:54ggt1https://play.nim-lang.org/#ix=3uTJ
15:47:32ggt1here is an example where I could not underscore cannot be added
15:57:07*liblq-dev quit (Quit: WeeChat 3.1)
16:06:49*maxime_ joined #nim
16:11:38*stkrdknmibalz joined #nim
16:27:02*rockcavera quit (Remote host closed the connection)
16:47:50arkanoidis it possible to define a type that enforces a string with a max length?
16:52:36LyndsySimonVery naive question: can I use Nim to compile a binary that I can use in the shell (Zsh in this case) to change directories?
16:53:07FromDiscord<Rika> i do not think any binary can change the pwd of a shell
16:53:13LyndsySimonFor example, a contrived and simplified use case: I'd like to replace a shell alias defined as `d=cd ~/foo` with a Nim script.
16:53:15LyndsySimonAhhh
16:53:16FromDiscord<Rika> `cd` is not a binary, its a shell utility
16:53:34FromDiscord<Rika> you can test that by doing `which cd`
16:53:36LyndsySimonYeah, I was aware of that, I just didn't know if a binary could access and modify the shell in which it was called.
16:53:37FromDiscord<Rika> and it will say none
16:53:50FromDiscord<Rika> well it can if the shell provides the functionality
16:54:06FromDiscord<Rika> maybe zsh does, i do not know, prolly a search would help there
16:54:12LyndsySimonFair enough. I have a simple script I need to write for work/productivity purposes, and it seemed like a small enough use case to jump back into Nim.
17:20:55*ggt1 quit (Quit: Client closed)
17:28:41arkanoidhow can I dump to console the source code that would be generated by a nimnode?
17:28:55arkanoidwithout actually genereting it into the project
17:29:00arkanoidI just need to debug
17:32:19FromDiscord<haxscramper> `echo node.repr()`
17:32:43FromDiscord<haxscramper> In the macro body, or `expandMacros` around the macro
17:33:08FromDiscord<haxscramper> But expand macros would not work if the body is invalid (typecheck fails, or invalid ast)
17:36:06arkanoidhaxscramper, thanks!
17:50:00arkanoidI'm creating this macro that creates a shitload of types (parsing xml schemas, quite a lot of stuff). What I don't have that I'd like to add to my logic is a way to "annotate" types with metadata such as "string max length" or "seq min lenght" and so on
17:50:33arkanoidI'd re-read this data further or to inforce the rules
17:51:18arkanoidI could also create a map to write these rules, but I believe nim can do better than that
17:53:01*thunder joined #nim
18:04:51FromDiscord<haxscramper> You can manually create types that mach XSD schema constraints and use them
18:05:13FromDiscord<haxscramper> And implement additional checks for .add and all they kind of stuff
18:06:00mstthis is the sort of problem where I start to ponder using explicit code generation to an extra file that gets compiled in
18:06:15mstjust because it makes it a lot easier to see what I'm doing and debug it
18:06:30FromDiscord<haxscramper> Yes, I wrote XML parser as well
18:06:36FromDiscord<haxscramper> And I did it in separate file
18:07:00FromDiscord<haxscramper> This also saves on compile time, because, well, 12k sloc of codegen for each macro run ...
18:08:27FromDiscord<haxscramper> https://github.com/haxscramper/nimtraits/blob/master/src/nimtraits/xml_to_types.nim codegen logic xsd https://github.com/haxscramper/hcparse/blob/master/src/hcparse/dox_compound.xsd and code https://github.com/haxscramper/hcparse/blob/master/src/hcparse/dox_compound.nim
18:09:38FromDiscord<haxscramper> And the only reason I was able to debug codegen is a standalone file generation
18:10:30mstright, the saving on compile time is absolutely a bonus as well, but the "I can actually debug this without wanting to stab myself in the scrotum with a rusty fork" was the truly awesome part :D
18:17:06arkanoidhaha
18:17:23arkanoidyeah I'm on the same boat. I plan to write NimNodes to different .nim files
18:19:57arkanoidhow did you enforce rules like min seq length?
18:20:03arkanoidvia runtime proc?
18:20:59arkanoidthis functions is a lie! https://nim-lang.org/docs/sequtils.html#items.i
18:21:42arkanoidI've an iterator that I can loop but all the "opIt" like filterIt doesn work
18:21:47arkanoideven after using items
18:22:01nrds<Prestige99> can you show an example?
18:23:39arkanoid"for foo in myXmlNode.attrs.keys" works, "for foo in myXmlNode.attrs.keys.items" Error: cannot generate VM code for yield t.data[h].key
18:27:01FromDiscord<haxscramper> In reply to @arkanoid "yeah I'm on the": You can use compiler API then, and don't need to overcome useless limitations like VM code
18:27:34FromDiscord<haxscramper> If you need to generate nim code and save it to a file you can just do it using compiler/ast
18:28:52FromDiscord<haxscramper> I wrote some helper procs in hnimast yo reduce differences, but you can just copy parts you need for codegen https://github.com/haxscramper/hnimast/blob/master/src/hnimast/hast_common.nim#L282
18:29:11FromDiscord<haxscramper> Difference between compiler/ast and macros is minimal
18:30:20*maxime_ quit (Ping timeout: 268 seconds)
18:30:27arkanoidwhat's the difference? I mean, why should I use compiler/ast when I can output nim code from NimNode from standard macro?
18:30:49FromDiscord<haxscramper> Because you have to deal with limited capabilities for nim VM?
18:31:16arkanoidand compiler doesn't?
18:31:35FromDiscord<haxscramper> Of course, it is just compiled nim code
18:32:36FromDiscord<haxscramper> It is also faster, at least because you don't have VM interpreter overhead. Which is not really big, but not no-existent
18:33:26arkanoidcan't wrap my head around this. Does it mean that I don't have to run macros at compile time but just regular proc that just builds NimNodes?
18:35:01arkanoidI think I need an example
18:41:11FromDiscord<haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/generate_nim_at_runtime.nim
18:41:51FromDiscord<haxscramper> You need some minor boilerplate since there are no `newLit` or `newIdent` for `PNode`,
18:41:59FromDiscord<haxscramper> That's why I added `func newPLit(i: BiggestInt): PNode = newIntTypeNode(i, PType(kind: tyInt))`
18:42:32FromDiscord<haxscramper> `hast_common.nim` that i linked earlier has all of them implemented
18:44:45arkanoidthanks a lot
18:46:41arkanoidall that addictional wrapping you have in hast_common is quite intimidating :P
18:47:12arkanoidvery nice code
18:50:00arkanoidI bet there's not dumpAstGen equivalent for compiler/ast
18:52:47FromDiscord<haxscramper> There is. Just s/nnk/nk/ for node kinds
18:52:50FromDiscord<haxscramper> Done
18:53:29FromDiscord<haxscramper> In reply to @arkanoid "all that addictional wrapping": A lot of this for things that are missing from std/macros as well
18:53:34FromDiscord<haxscramper> Like newReturn
18:53:57FromDiscord<haxscramper> addBranch that uniformly works for if/case/try
18:54:38FromDiscord<haxscramper> newXCall that allows to generate code for infix/prefix/call statements without tons of ifs
18:54:46FromDiscord<haxscramper> And other quality of life features
18:58:29arkanoidmay I ask you what's your way to import "compiler/*". It's the first time I try dealing with god's machinery
18:59:06arkanoidis just git clone nim compiler repo and add the path to module search?
19:01:24*maxime_ joined #nim
19:03:18arkanoidoh! there's a nimble package for that! Noice
19:06:25*beshr joined #nim
19:25:09*maxime_ quit (Ping timeout: 276 seconds)
19:33:55*max22- joined #nim
19:36:07*max22- quit (Remote host closed the connection)
19:36:24*max22- joined #nim
19:51:00arkanoidhaxscramper, I'm finding quite a lot of difficulties in debugging code with compiler/ast
19:51:30arkanoidif gives zero hints in stacktrace where the problem happens
19:53:19FromDiscord<haxscramper> Can you elaborate what you mean? Nim compiler/ast is just a regular nim code, I'd it raises exception it shows all the stacktraces
19:54:35arkanoidhaxscramper, like https://play.nim-lang.org/#ix=3uUM
19:55:07arkanoidline 114 is last line "echo myPNode"
19:55:32arkanoidbasically it fails to render tree, but how to know where?
19:56:29FromDiscord<haxscramper> Same as macros - treeRepr and look over the output
19:56:53FromDiscord<haxscramper> Well, compiler calls it astalgo.dump IIRC
19:57:00FromDiscord<haxscramper> Hnimast has normal treeRepr
20:00:14arkanoidthere's no treeRepr for PNode
20:04:01FromDiscord<haxscramper> Yes, that's exactly what I said just now. https://haxscramper.github.io/hnimast/src/hnimast/hast_common.html#treeRepr%2CPNode%2Cbool%2Cbool%2Cbool%2Cint%2Cint
20:04:52FromDiscord<haxscramper> Compier API is a little rough on the quality-of-life features that were added to macros
20:11:19arkanoidwhoa, hnimast treerepr is super!
20:12:49FromDiscord<haxscramper> Yes. I should probably add checks for missing subnode index, to show invalid/unexpected nodes in the trees, though not right now
20:13:30arkanoidI now have to wrap my head around the differences between macro and compiler/ast. I'm trying to replace my old code
20:18:03*rockcavera joined #nim
20:18:03*rockcavera quit (Changing host)
20:18:03*rockcavera joined #nim
20:34:16arkanoidhooray! it works! Thanks a lot haxscramper again. For the lib and the wise hints
20:34:17FromDiscord<Ayy Lmao> I'm having an issue where I want to make something async but have no idea how to do it. It involves an event loop driven by a win32 window. My window implementation abstracts the win32 api away and uses closures to customize behavior. This seems to make doing any async code impossible because the compiler complains that I'm not being memory safe. I wrote some example code: https://play.nim-lang.org/#ix=3uUY
20:56:31FromDiscord<haxscramper> Welcome to the "dealing with god's machinery" club
21:03:13FromDiscord<dom96> @Ayy Lmao you need to integrate the async event loop with win32's. You'll need to do some research on how to best do this, worst case you can just call asyncdispatch.poll every few miliseconds.
21:05:26FromDiscord<Ayy Lmao> In reply to @dom96 "<@!277645179115143178> you need to": I am able to set a timer with the win32 api and I was thinking I would just call `poll` in there. My problem is that I can't seem to make any of my functions `async` because of memory safety issues.
21:06:04FromDiscord<dom96> what memory safety issues?
21:06:34FromDiscord<Ayy Lmao> Like in my example try to make `longCalculationThatBlocksTheThread` async and the compiler will complain
21:07:18FromDiscord<dom96> oh you can't use `var T` in async
21:07:26FromDiscord<dom96> but you don't need `var` there
21:07:30FromDiscord<dom96> this type is already a ref
21:08:49FromDiscord<Ayy Lmao> Oh interesting. I seem to be confused of what `var` means. I was thinking that `var` was simply used to mark when you are changing the thing that is passed in.
21:09:32FromDiscord<Ayy Lmao> I guess that only applies to non ref objects then
21:15:06*neceve quit (Ping timeout: 258 seconds)
21:15:41FromDiscord<Ayy Lmao> So there is never a case where `var ref` does anything useful?
21:16:25FromDiscord<dom96> indeed
21:20:58FromDiscord<Ayy Lmao> I have it working now by removing var. I was wondering, `poll` seems to raise an exception when there are no handles in the dispatcher. How should I deal with that in my case, because there are times where my calculation will finish and doesn't need to be updated. Do I need to always keep track of when the calculation is being performed and only poll then?
21:22:14FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3uVh
21:22:38FromDiscord<Ayy Lmao> (edit) "https://play.nim-lang.org/#ix=3uVh" => "https://play.nim-lang.org/#ix=3uVi"
21:28:47FromDiscord<Elegantbeef> Well you're not handling the exception in anyway which will bite your ass in the future, i'd say at the very least do the lazy thing of `echo getCurrentExceptionMsg()` just to give feedback
21:33:21FromDiscord<Ayy Lmao> My program is an extension that is run in another program, and currently any exceptions will be seen by the user. If I allow poll to raise an exception it will spam the user. I guess the proper way is to manually keep track of when I need to poll then?
21:35:45FromDiscord<Ayy Lmao> Is there some reason of why `poll` shouldn't be called when there are no events in the dispatcher? Does it have a lot of overhead or something?
21:40:17FromDiscord<Ayy Lmao> I guess my case is kind of niche and this isn't an issue in most cases.
21:50:51arkanoidI'm trying to filter xmlattributesO.attrs via filter/filterIt, but it's not working
21:51:04arkanoidI'm no more trying this at compile time but runtime
21:52:53*flynn quit (Read error: Connection reset by peer)
21:54:02*flynn joined #nim
22:08:44FromDiscord<deech> How do I make a `const` pointer for FFI purposes?,eg. I have `ptr cchar` and I want `const char` but that's just one example.
22:15:25FromDiscord<Elegantbeef> @deech\: i could be wrong but i think https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma
23:10:24*cornfeedhobo left #nim (when i leave, come together like butt cheeks)
23:17:32FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3uVB
23:23:09FromDiscord<@bracketmaster-5a708063d73408ce4> I know `$` is stringify, is there also something like `toString`?
23:23:32*max22- quit (Remote host closed the connection)
23:30:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3uVF
23:37:34*rockcavera quit (Remote host closed the connection)
23:48:02*auxym joined #nim