00:06:00 | * | bkay quit (Quit: Leaving) |
00:21:24 | FromDiscord | <@bracketmaster-5a708063d73408ce4> why is nim packaged with both nre and re, both of which a wrappers around pcre? |
00:22:04 | FromDiscord | <Elegantbeef> legacy support + lack of a way to nicely remove packages from the stdlib |
00:22:19 | FromDiscord | <@bracketmaster-5a708063d73408ce4> which one is legacy? |
00:22:32 | FromDiscord | <Elegantbeef> I dont know i just suggest using `nim-regex` from nimble |
00:22:49 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I don't like nim-regex |
00:22:54 | FromDiscord | <@bracketmaster-5a708063d73408ce4> it wasn't working for me |
00:23:08 | FromDiscord | <@bracketmaster-5a708063d73408ce4> match("hello my world", re"hello\|world.\", matches\_found) |
00:23:13 | FromDiscord | <@bracketmaster-5a708063d73408ce4> that's nim-regex |
00:23:18 | FromDiscord | <@bracketmaster-5a708063d73408ce4> and it returns false |
00:23:19 | FromDiscord | <Rika> re is the "legacy" but nre is the lesser used |
00:23:37 | FromDiscord | <Rika> In reply to @@bracketmaster-5a708063d73408ce4 "match("hello my world", re"hello\|world.\*",": this is wrong |
00:23:40 | FromDiscord | <Rika> is it not? |
00:23:45 | FromDiscord | <Elegantbeef> Seems like it's less of "not liking it" and it just not working for you \:D |
00:23:55 | FromDiscord | <Rika> your regex is wrong is what i mean |
00:24:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> is it? |
00:24:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://regex101.com |
00:24:19 | FromDiscord | <Rika> ah, no its not |
00:24:53 | FromDiscord | <Rika> different perception of precedence |
00:26:21 | FromDiscord | <Rika> !eval import regex; match("hello my world", re"hello|world.") |
00:26:24 | NimBot | Compile 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:24 | FromDiscord | <Rika> fuck |
00:26:26 | FromDiscord | <Rika> didnt echo |
00:26:30 | FromDiscord | <Rika> !eval import regex; echo match("hello my world", re"hello|world.") |
00:26:36 | NimBot | false |
00:26:50 | FromDiscord | <Rika> ah |
00:26:53 | FromDiscord | <Rika> its because of the . |
00:27:15 | FromDiscord | <Rika> i assume |
00:27:18 | FromDiscord | <Rika> !eval import regex; echo match("hello my world", re"hello|world") |
00:27:24 | NimBot | false |
00:27:40 | FromDiscord | <Rika> might be a faulty implementation of | then |
00:27:44 | FromDiscord | <konsumlamm> my guess is that it's because of matching the whole string vs somewhere in it |
00:27:49 | FromDiscord | <Rika> !eval import regex; echo match("hello my world", re"(hello)|(world)") |
00:27:54 | NimBot | false |
00:28:01 | FromDiscord | <konsumlamm> i.e. it just has different behaviour, by deisgn |
00:28:18 | FromDiscord | <Rika> oh |
00:28:27 | FromDiscord | <Rika> `match` only works if the whole string matches |
00:28:36 | thunder | !eval import regex; echo match("hello my world", re"(hello|world)") |
00:28:41 | NimBot | false |
00:28:48 | FromDiscord | <Rika> !eval import regex; echo find("hello my world", re"hello|world.") |
00:28:50 | NimBot | Compile failed: /playground/nim/lib/system.nim(1806, 10) Error: type mismatch: got <char, Regex> |
00:29:04 | FromDiscord | <Rika> i mean findAll |
00:29:11 | FromDiscord | <Rika> !eval import regex; echo findAll("hello my world", re"hello|world.") |
00:29:16 | NimBot | @[(captures: @[], namedGroups: (data: @[], counter: 0, first: 0, last: 0), boundaries: 0 .. 4)] |
00:29:38 | FromDiscord | <Rika> it only captured one |
00:29:40 | FromDiscord | <Rika> odd |
00:30:17 | thunder | "world." would tmk match the world world followed by any char. but if there is no char after world, then no match |
00:30:25 | thunder | *word world |
00:30:41 | FromDiscord | <Rika> there is a |
00:30:48 | FromDiscord | <Rika> did the bridge destroy the fucking asteisk |
00:30:50 | FromDiscord | <Rika> (edit) "asteisk" => "asterisk" |
00:30:57 | thunder | yeah |
00:31:01 | FromDiscord | <Rika> great |
00:31:11 | FromDiscord | <Rika> !eval import regex; echo findAll("hello my world", re"hello|world.\") |
00:31:13 | FromDiscord | <Rika> how about now |
00:31:16 | thunder | nope |
00:31:17 | NimBot | @[(captures: @[], namedGroups: (data: @[], counter: 0, first: 0, last: 0), boundaries: 0 .. 4)] |
00:31:24 | thunder | asterisk was nuked |
00:31:25 | FromDiscord | <Rika> you try it |
00:31:32 | FromDiscord | <Rika> just copy but add the asterisk lmao |
00:31:36 | FromDiscord | <Rika> should work then |
00:31:39 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @\_discord\_259277943275126785\:t2bot.io , I see the astericks |
00:31:45 | thunder | !eval import regex; echo findAll("hello my world", re"hello|world.\*") |
00:31:50 | FromDiscord | <Rika> matrix goes through a different bridge |
00:31:56 | thunder | !eval import regex; echo findAll("hello my world", re"hello|world.\*") |
00:32:03 | NimBot | @[(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:22 | FromDiscord | <Rika> still one 🤔 |
00:34:06 | * | nixfreak_nim[m] joined #nim |
00:34:55 | FromDiscord | <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:05 | FromDiscord | <Rika> and it will not have the same runtime guarantees as reges |
00:35:06 | FromDiscord | <Rika> (edit) "reges" => "regex" |
00:42:02 | FromDiscord | <sunsilk> #ask I want to ask if there is a requests library in python, what about nim? |
00:42:32 | FromDiscord | <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:53 | FromDiscord | <bolino> sent a long message, see http://ix.io/3uQB |
03:34:10 | FromDiscord | <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:48 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> @bolino\: Row is a `seq[string]` |
04:32:06 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-4/lib/impure/db_mysql.nim#L95 |
04:32:29 | FromDiscord | <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:48 | FromDiscord | <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:41 | FromDiscord | <Elegantbeef> well since it's a row you can do `.seq` or `seq[string](yourRow)` no? |
05:24:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3uQW |
05:29:39 | FromDiscord | <Elegantbeef> Also worth noting `sugar.collect` and `sequtils.toSeq` are both better methods to what your first suggestion was @bolino |
05:31:48 | FromDiscord | <Elegantbeef> \now noticing that it's a `seq[Row]` and i assume you want a single `seq[string]` |
05:38:45 | FromDiscord | <bolino> > now noticing that it's a seq[Row] and i assume you want a single seq[string] |
05:38:51 | FromDiscord | <bolino> (edit) "seq[string]" => "seq[string]↵exactly" |
05:39:28 | FromDiscord | <bolino> In reply to @Elegantbeef "\*now noticing that it's": exactly |
05:42:42 | FromDiscord | <Elegantbeef> then afaik yea best way of handling it |
05:46:07 | FromDiscord | <Rika> Nice |
05:57:38 | FromDiscord | <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:42 | FromDiscord | <bolino> does that make sense? |
05:58:10 | FromDiscord | <Elegantbeef> Like i said use your method or collect |
06:00:01 | FromDiscord | <bolino> In reply to @Elegantbeef "Like i said use": Okaye, gotcha |
06:00:04 | FromDiscord | <bolino> thanks! |
06:07:10 | FromDiscord | <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:45 | FromDiscord | <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:01 | FromDiscord | <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:36 | arkanoid | I'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:21 | arkanoid | I 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:18 | arkanoid | question 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:36 | arkanoid | I mean without writing .nim files |
07:25:23 | FromDiscord | <Rika> Generate proc at runtime? |
07:33:25 | FromDiscord | <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:17 | FromDiscord | <Rika> But it will generate the code every time you compile |
07:34:20 | FromDiscord | <Rika> Which may be slow |
07:34:33 | FromDiscord | <Rika> Saving to another file may be better depending on your opinion |
07:45:47 | arkanoid | Rika, 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:12 | arkanoid | probably there's not much difference between the two |
07:46:31 | FromDiscord | <Rika> Well as I’ve said it may cause a compile time length difference |
07:47:05 | FromDiscord | <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:06 | arkanoid | I'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:52 | FromDiscord | <Rika> What? |
08:04:10 | FromDiscord | <Rika> Ah you mean testing the macro logic? |
08:04:43 | FromDiscord | <Rika> I would do the proc one but your choice I think |
08:08:15 | arkanoid | I 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:57 | FromDiscord | <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:33 | arkanoid | do you think is possible to parse xml at compile time? |
09:48:06 | arkanoid | XmlNode cannot be const :( |
09:48:29 | arkanoid | this makes the "read wsdl and build interface at compile time" impossible |
09:49:02 | arkanoid | I need read wsdl at runtime, generate the required nim code and write files to disk |
09:49:19 | arkanoid | so not even macro are usable, only runtime code |
09:49:30 | arkanoid | basically I've to write nim code with strings? |
09:51:53 | emery | arkanoid: 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:06 | arkanoid | can I use ref types at compile time? |
09:54:02 | emery | I don't think so, but you can have containers holding objects |
09:54:34 | arkanoid | k, ,let's try |
09:55:18 | arkanoid | I'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:15 | arkanoid | os.currentSourcePath returns my project path correctly |
10:07:45 | arkanoid | solved with getProjectPath |
10:08:02 | arkanoid | the xml schema parsing works at compile time! yeah! |
10:09:11 | arkanoid | what's the signature of a function that takes a string and returns a type definition? like "xs:string" -> string |
10:11:29 | arkanoid | I'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:32 | arkanoid | oh, 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:26 | FromDiscord | <Rika> In reply to @arkanoid "can I use ref": not deeply nested ref |
10:29:52 | FromDiscord | <Rika> so you can have a seq to a regular object, but a seq to a ref is prolly not ok |
10:33:40 | FromDiscord | <ynfle (ynfle)> https://play.nim-lang.org/#ix=3uSe Is this a bug? |
10:43:02 | arkanoid | Rika, 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:10 | FromDiscord | <haxscramper> no, `x: NimNode` is a procedure argument |
11:10:13 | FromDiscord | <haxscramper> So it is not accessible at compile-time |
11:10:14 | * | xet7 quit (Remote host closed the connection) |
11:10:33 | FromDiscord | <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:44 | arkanoid | can you help me spot where the error is here? https://play.nim-lang.org/#ix=3uSx |
12:20:11 | arkanoid | I really don't see how's possible that a rangedefect can be raised from that code |
12:24:03 | arkanoid | the 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:58 | arkanoid | this is the best solution I've found, yet I'm failing in parametrizing genTypeSection macro |
12:37:44 | arkanoid | I've tried them all: static[openArray[NimNode]], static[varargs[NimNode]], ... |
12:40:23 | arkanoid | if 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:52 | arkanoid | so the question is, can I pass NimNode arguments to a macro? |
12:51:25 | federico3 | isn't this syntax a bit too verbose? raise newException(SomethingError, "...") |
12:52:16 | FromDiscord | <Rika> there is another `raise (ref SomethingError)(message: "...")` that some prefer |
12:53:08 | FromDiscord | <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:40 | FromDiscord | <haxscramper> You can make exception a ref object of |
12:57:10 | FromDiscord | <haxscramper> But then it will complain when someone tries to raise it via new exception |
12:57:47 | FromDiscord | <haxscramper> But I prefer to just write normal constructor, in a lot of cases it makes things easier |
12:58:56 | FromDiscord | <Rika> yes i know you can |
13:04:29 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=3uSO |
13:05:07 | FromDiscord | <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:28 | FromDiscord | <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:35 | arkanoid | I'd consider the long exception raise expression as a suggestion to use Option and monads instead :P |
13:10:59 | FromDiscord | <Rika> now you have a tonne of `isNone` `none()` `some()` |
13:11:02 | FromDiscord | <Rika> xd |
13:11:23 | FromDiscord | <Rika> oh dont forget `get` even after `isNone` |
13:11:38 | FromDiscord | <Rika> i mean `isSome` i guess |
13:12:46 | arkanoid | not 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:50 | FromDiscord | <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:30 | FromDiscord | <Rika> In reply to @arkanoid "not needed when using": i guess that simplifies it quite a bit `opt.flatMap() do (...) -> Option[...]: ...` |
13:24:05 | arkanoid | not yet used to "do" syntax, actually I don't find it sexy |
13:24:14 | FromDiscord | <Rika> to each their own |
13:28:25 | FromDiscord | <Clonkk> What does `Error: system module needs: nimGCvisit` means ? |
13:28:50 | FromDiscord | <Rika> your platform does not implement some stuff that system needs |
13:29:07 | FromDiscord | <Rika> are you using embedded platforms or something that isnt linux/macos/windows/bsd? |
13:29:19 | FromDiscord | <Clonkk> Plair Linux x84\_64↵(@Rika) |
13:29:35 | FromDiscord | <Clonkk> OpenSuse, so it's pretty vanilla |
13:29:40 | FromDiscord | <@bracketmaster-5a708063d73408ce4> treeform/print basically prints out a nim structure |
13:29:49 | FromDiscord | <haxscramper> i got this error when one `.cfg` specified `--gc:orc` and other (in the parent directory) `--gc:refc` |
13:29:55 | FromDiscord | <Rika> thats weird wtf |
13:30:00 | FromDiscord | <@bracketmaster-5a708063d73408ce4> is there a way to write treeform/print output to a file instead of to stdout? |
13:30:14 | FromDiscord | <@bracketmaster-5a708063d73408ce4> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/872108962919624724): treeform/print basically prints out valid nim code |
13:30:14 | FromDiscord | <Clonkk> Ah↵(@haxscramper) |
13:30:17 | FromDiscord | <Clonkk> Well |
13:30:17 | FromDiscord | <Clonkk> Yeah |
13:30:19 | FromDiscord | <Clonkk> Probably |
13:30:27 | FromDiscord | <Clonkk> Thought commandLine override confuig file ? |
13:31:47 | FromDiscord | <Clonkk> So if oyu use --gc\:refc on commandLine and you have --gc\:orc in a config file yo ucan't compile |
13:31:48 | FromDiscord | <Clonkk> ? |
13:32:04 | FromDiscord | <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:28 | FromDiscord | <haxscramper> https://github.com/treeform/print/blob/master/src/print.nim#L239 no, it seems hardcoded |
13:33:40 | FromDiscord | <Clonkk> You can always capture stdout output |
13:33:48 | * | nrds joined #nim |
13:37:33 | FromDiscord | <DeathByRebellion> I remember WipEout. That was such an awesome racing game |
13:39:24 | FromDiscord | <DeathByRebellion> Anyways |
13:39:34 | FromDiscord | <DeathByRebellion> What are you guys talking about? |
13:39:48 | FromDiscord | <DeathByRebellion> I need to practice Nim Programming. What's the best way to do so? |
13:40:00 | FromDiscord | <DeathByRebellion> I can't come up with any ideas that aren't behind my skill level |
13:40:10 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Nice name |
13:40:24 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Write a C- compiler? |
13:40:37 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Write a static website server? |
13:40:48 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Write a discord implementation not based on electron? |
13:41:06 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Write a slack implementation not based on electron? With cimgui bindings? |
13:41:43 | nrds | <Prestige99> Or maybe something simpler like an irc bot |
13:41:53 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Note that that was "C-" not C |
13:42:01 | FromDiscord | <@bracketmaster-5a708063d73408ce4> C- is pretty simple |
13:42:10 | FromDiscord | <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:19 | federico3 | DeathByRebellion a multi-protocol IM client please :) |
13:49:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> yeah - that'd be nice |
13:49:15 | FromDiscord | <@bracketmaster-5a708063d73408ce4> something I might even pay for |
13:49:23 | FromDiscord | <@bracketmaster-5a708063d73408ce4> As long as it doesn't take up 1GB of ram |
13:50:36 | FromDiscord | <@bracketmaster-5a708063d73408ce4> opening slack and discord eats up 2 out of my measly 8GB of ram |
13:50:53 | FromDiscord | <@bracketmaster-5a708063d73408ce4> spotify makes for 3GB |
13:50:57 | FromDiscord | <Clonkk> Anything with a GUI is going to be a PITA to do for a side project |
13:51:21 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Well - it will take dedication - Cimgui is not so bad |
13:51:53 | FromDiscord | <Clonkk> Enable notification by email / on your phone. Go on the desktop app / website version only when notified |
13:52:39 | FromDiscord | <@bracketmaster-5a708063d73408ce4> or just build something better 😛 |
13:53:19 | FromDiscord | <@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:26 | FromDiscord | <@bracketmaster-5a708063d73408ce4> There's really no excuse |
13:53:33 | FromDiscord | <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:09 | FromDiscord | <haxscramper> 30mb for discord |
13:54:09 | FromDiscord | <haxscramper> Why can'y you people just open discord in browser? |
13:54:10 | FromDiscord | <haxscramper> done |
13:54:14 | FromDiscord | <Clonkk> 👍️ |
13:54:23 | FromDiscord | <@bracketmaster-5a708063d73408ce4> check your CPU usage for discord in browser |
13:54:28 | FromDiscord | <@bracketmaster-5a708063d73408ce4> tell me what you find |
13:56:05 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Discord in safari shows up at 500MB |
13:56:22 | FromDiscord | <DeathByRebellion> I've never heard of C- in my entire life |
13:56:35 | FromDiscord | <Clonkk> At the moment, my discord tab uses ~280 MB (after having clicked on every server I had) |
13:56:38 | FromDiscord | <carmysilna> might be talking about ghc's cmm |
13:56:39 | FromDiscord | <Clonkk> Not that bad |
13:57:07 | FromDiscord | <@bracketmaster-5a708063d73408ce4> 280MB is absolutely nuts!! |
13:57:15 | FromDiscord | <@bracketmaster-5a708063d73408ce4> The english bible is 5MB |
13:57:28 | FromDiscord | <haxscramper> Firefox reports discord tab memory usage at 31.6mb, and cpu usage as "low, 0.7" |
13:57:58 | FromDiscord | <@bracketmaster-5a708063d73408ce4> lemme try firefox |
13:58:45 | FromDiscord | <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:57 | FromDiscord | <haxscramper> but assuming something like idris - we don't have anything of that sort |
13:59:16 | FromDiscord | <Clonkk> You're comparing a dynamic web page with a static content... |
13:59:32 | FromDiscord | <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:56 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Firefox isn't adding up |
14:00:10 | FromDiscord | <@bracketmaster-5a708063d73408ce4> So activity monitor shows a total of 700Mb for firefox |
14:00:15 | FromDiscord | <@bracketmaster-5a708063d73408ce4> but only 11MB for discord |
14:00:27 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I only have discord open in Firefox |
14:00:52 | FromDiscord | <@bracketmaster-5a708063d73408ce4> That is, firefox task manager shows only 11mb for discord |
14:00:53 | FromDiscord | <Clonkk> Activity Monitor can lie to you |
14:01:11 | FromDiscord | <Clonkk> Because some process expects to uses a lot of RAM so they pre-allocate RAM that isn't actually use |
14:01:34 | FromDiscord | <Clonkk> It's like VIRT and RES on Linux when you top |
14:02:13 | FromDiscord | <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:35 | FromDiscord | <virdisn> @haxscramper https://github.com/nim-lang/Nim/issues/18639 🙂 |
14:02:38 | federico3 | I wouldn't need a client. Anything that can act as Quassel or weechat (not wechat) server would do |
14:03:34 | FromDiscord | <@bracketmaster-5a708063d73408ce4> true |
14:04:18 | FromDiscord | <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:31 | FromDiscord | <haxscramper> It's a shame github wiki does not have "git blame" support |
14:07:25 | nrds | <Prestige99> can't clone it as a repo? |
14:10:08 | FromDiscord | <haxscramper> yes, I forgot about that |
14:10:17 | FromDiscord | <haxscramper> and yes, it was authored by @juan_carlos |
14:24:23 | FromDiscord | <Clonkk> Is there any Nim lib to press a key / move your mouse by code on Linux ? |
14:24:30 | arkanoid | do you know if it's possible to curl/download a file at compile time? |
14:25:34 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I don't see why you couldn't call curl in a static block |
14:26:11 | FromDiscord | <Clonkk> You can call a CLI program at compile time with `gorge` / `staticExec`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
14:28:10 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3uT7 |
14:32:34 | * | [R] quit (Ping timeout: 240 seconds) |
14:36:22 | FromDiscord | <gogolxdong (liuxiaodong)> Anyone knows `Could not download: No SSL/TLS CA certificates found.`? |
14:38:45 | FromDiscord | <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:40 | arkanoid | Clonkk thanks! |
15:14:35 | ggt1 | in a template, how to have an underscore when creating an identifier with backticks? |
15:14:52 | ggt1 | somthing like this `prefix_ variable` |
15:15:32 | ggt1 | nim complains about trailing underscore |
15:17:57 | ggt1 | usecase: https://play.nim-lang.org/#ix=3uTx |
15:28:48 | FromDiscord | <Rika> i do not see any trailing underscore errors in your use case |
15:29:45 | FromDiscord | <Rika> nonetheless, just remove the trailing underscore. its not required |
15:29:53 | FromDiscord | <Rika> so `e y` will work |
15:29:55 | ggt1 | oh, I missed a space. `e.e_ y` |
15:31:36 | FromDiscord | <Rika> either "echo e.`e y`" or "echo `e y`" will work |
15:33:01 | ggt1 | "echo e.`e y`" was what I need, thx |
15:33:22 | ggt1 | still this works because a_b and ab are the same identifiers in nim |
15:33:35 | FromDiscord | <Rika> yes |
15:33:36 | ggt1 | but it is not possible to create a_b in the template |
15:33:43 | FromDiscord | <Rika> it does not matter |
15:34:05 | ggt1 | if I try to print the id as string with a astToStr for example |
15:34:11 | ggt1 | it will be without an undescore |
15:34:18 | FromDiscord | <Rika> lets see |
15:34:39 | FromDiscord | <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:54 | ggt1 | https://play.nim-lang.org/#ix=3uTJ |
15:47:32 | ggt1 | here 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:50 | arkanoid | is it possible to define a type that enforces a string with a max length? |
16:52:36 | LyndsySimon | Very 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:07 | FromDiscord | <Rika> i do not think any binary can change the pwd of a shell |
16:53:13 | LyndsySimon | For 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:15 | LyndsySimon | Ahhh |
16:53:16 | FromDiscord | <Rika> `cd` is not a binary, its a shell utility |
16:53:34 | FromDiscord | <Rika> you can test that by doing `which cd` |
16:53:36 | LyndsySimon | Yeah, 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:37 | FromDiscord | <Rika> and it will say none |
16:53:50 | FromDiscord | <Rika> well it can if the shell provides the functionality |
16:54:06 | FromDiscord | <Rika> maybe zsh does, i do not know, prolly a search would help there |
16:54:12 | LyndsySimon | Fair 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:41 | arkanoid | how can I dump to console the source code that would be generated by a nimnode? |
17:28:55 | arkanoid | without actually genereting it into the project |
17:29:00 | arkanoid | I just need to debug |
17:32:19 | FromDiscord | <haxscramper> `echo node.repr()` |
17:32:43 | FromDiscord | <haxscramper> In the macro body, or `expandMacros` around the macro |
17:33:08 | FromDiscord | <haxscramper> But expand macros would not work if the body is invalid (typecheck fails, or invalid ast) |
17:36:06 | arkanoid | haxscramper, thanks! |
17:50:00 | arkanoid | I'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:33 | arkanoid | I'd re-read this data further or to inforce the rules |
17:51:18 | arkanoid | I 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:51 | FromDiscord | <haxscramper> You can manually create types that mach XSD schema constraints and use them |
18:05:13 | FromDiscord | <haxscramper> And implement additional checks for .add and all they kind of stuff |
18:06:00 | mst | this is the sort of problem where I start to ponder using explicit code generation to an extra file that gets compiled in |
18:06:15 | mst | just because it makes it a lot easier to see what I'm doing and debug it |
18:06:30 | FromDiscord | <haxscramper> Yes, I wrote XML parser as well |
18:06:36 | FromDiscord | <haxscramper> And I did it in separate file |
18:07:00 | FromDiscord | <haxscramper> This also saves on compile time, because, well, 12k sloc of codegen for each macro run ... |
18:08:27 | FromDiscord | <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:38 | FromDiscord | <haxscramper> And the only reason I was able to debug codegen is a standalone file generation |
18:10:30 | mst | right, 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:06 | arkanoid | haha |
18:17:23 | arkanoid | yeah I'm on the same boat. I plan to write NimNodes to different .nim files |
18:19:57 | arkanoid | how did you enforce rules like min seq length? |
18:20:03 | arkanoid | via runtime proc? |
18:20:59 | arkanoid | this functions is a lie! https://nim-lang.org/docs/sequtils.html#items.i |
18:21:42 | arkanoid | I've an iterator that I can loop but all the "opIt" like filterIt doesn work |
18:21:47 | arkanoid | even after using items |
18:22:01 | nrds | <Prestige99> can you show an example? |
18:23:39 | arkanoid | "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:01 | FromDiscord | <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:34 | FromDiscord | <haxscramper> If you need to generate nim code and save it to a file you can just do it using compiler/ast |
18:28:52 | FromDiscord | <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:11 | FromDiscord | <haxscramper> Difference between compiler/ast and macros is minimal |
18:30:20 | * | maxime_ quit (Ping timeout: 268 seconds) |
18:30:27 | arkanoid | what's the difference? I mean, why should I use compiler/ast when I can output nim code from NimNode from standard macro? |
18:30:49 | FromDiscord | <haxscramper> Because you have to deal with limited capabilities for nim VM? |
18:31:16 | arkanoid | and compiler doesn't? |
18:31:35 | FromDiscord | <haxscramper> Of course, it is just compiled nim code |
18:32:36 | FromDiscord | <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:26 | arkanoid | can'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:01 | arkanoid | I think I need an example |
18:41:11 | FromDiscord | <haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/generate_nim_at_runtime.nim |
18:41:51 | FromDiscord | <haxscramper> You need some minor boilerplate since there are no `newLit` or `newIdent` for `PNode`, |
18:41:59 | FromDiscord | <haxscramper> That's why I added `func newPLit(i: BiggestInt): PNode = newIntTypeNode(i, PType(kind: tyInt))` |
18:42:32 | FromDiscord | <haxscramper> `hast_common.nim` that i linked earlier has all of them implemented |
18:44:45 | arkanoid | thanks a lot |
18:46:41 | arkanoid | all that addictional wrapping you have in hast_common is quite intimidating :P |
18:47:12 | arkanoid | very nice code |
18:50:00 | arkanoid | I bet there's not dumpAstGen equivalent for compiler/ast |
18:52:47 | FromDiscord | <haxscramper> There is. Just s/nnk/nk/ for node kinds |
18:52:50 | FromDiscord | <haxscramper> Done |
18:53:29 | FromDiscord | <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:34 | FromDiscord | <haxscramper> Like newReturn |
18:53:57 | FromDiscord | <haxscramper> addBranch that uniformly works for if/case/try |
18:54:38 | FromDiscord | <haxscramper> newXCall that allows to generate code for infix/prefix/call statements without tons of ifs |
18:54:46 | FromDiscord | <haxscramper> And other quality of life features |
18:58:29 | arkanoid | may I ask you what's your way to import "compiler/*". It's the first time I try dealing with god's machinery |
18:59:06 | arkanoid | is just git clone nim compiler repo and add the path to module search? |
19:01:24 | * | maxime_ joined #nim |
19:03:18 | arkanoid | oh! 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:00 | arkanoid | haxscramper, I'm finding quite a lot of difficulties in debugging code with compiler/ast |
19:51:30 | arkanoid | if gives zero hints in stacktrace where the problem happens |
19:53:19 | FromDiscord | <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:35 | arkanoid | haxscramper, like https://play.nim-lang.org/#ix=3uUM |
19:55:07 | arkanoid | line 114 is last line "echo myPNode" |
19:55:32 | arkanoid | basically it fails to render tree, but how to know where? |
19:56:29 | FromDiscord | <haxscramper> Same as macros - treeRepr and look over the output |
19:56:53 | FromDiscord | <haxscramper> Well, compiler calls it astalgo.dump IIRC |
19:57:00 | FromDiscord | <haxscramper> Hnimast has normal treeRepr |
20:00:14 | arkanoid | there's no treeRepr for PNode |
20:04:01 | FromDiscord | <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:52 | FromDiscord | <haxscramper> Compier API is a little rough on the quality-of-life features that were added to macros |
20:11:19 | arkanoid | whoa, hnimast treerepr is super! |
20:12:49 | FromDiscord | <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:30 | arkanoid | I 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:16 | arkanoid | hooray! it works! Thanks a lot haxscramper again. For the lib and the wise hints |
20:34:17 | FromDiscord | <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:31 | FromDiscord | <haxscramper> Welcome to the "dealing with god's machinery" club |
21:03:13 | FromDiscord | <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:26 | FromDiscord | <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:04 | FromDiscord | <dom96> what memory safety issues? |
21:06:34 | FromDiscord | <Ayy Lmao> Like in my example try to make `longCalculationThatBlocksTheThread` async and the compiler will complain |
21:07:18 | FromDiscord | <dom96> oh you can't use `var T` in async |
21:07:26 | FromDiscord | <dom96> but you don't need `var` there |
21:07:30 | FromDiscord | <dom96> this type is already a ref |
21:08:49 | FromDiscord | <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:32 | FromDiscord | <Ayy Lmao> I guess that only applies to non ref objects then |
21:15:06 | * | neceve quit (Ping timeout: 258 seconds) |
21:15:41 | FromDiscord | <Ayy Lmao> So there is never a case where `var ref` does anything useful? |
21:16:25 | FromDiscord | <dom96> indeed |
21:20:58 | FromDiscord | <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:14 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3uVh |
21:22:38 | FromDiscord | <Ayy Lmao> (edit) "https://play.nim-lang.org/#ix=3uVh" => "https://play.nim-lang.org/#ix=3uVi" |
21:28:47 | FromDiscord | <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:21 | FromDiscord | <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:45 | FromDiscord | <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:17 | FromDiscord | <Ayy Lmao> I guess my case is kind of niche and this isn't an issue in most cases. |
21:50:51 | arkanoid | I'm trying to filter xmlattributesO.attrs via filter/filterIt, but it's not working |
21:51:04 | arkanoid | I'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:44 | FromDiscord | <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:25 | FromDiscord | <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:32 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3uVB |
23:23:09 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I know `$` is stringify, is there also something like `toString`? |
23:23:32 | * | max22- quit (Remote host closed the connection) |
23:30:42 | FromDiscord | <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 |