<< 19-02-2022 >>

00:06:02FromDiscord<Forest> In reply to @exelotl "yeah, certain nim binaries": Eh? But why?
00:06:50FromDiscord<Rika> Because heuristics are not infallible?
00:07:31FromDiscord<Forest> Fair enough, but surely people have reported it as a false positive?
00:09:29PMunchYeah, some people have
00:09:46PMunchWhether or not it's enough for the virus vendors to care though is another question..
00:10:28FromDiscord<Rika> Yes
00:11:22PMunchI guess that's the price to pay for being an easy to use language with little overhead that can run anywhere, people are going to write malware in it
00:11:32FromDiscord<xx_ns> as someone who has spent a lot of time debugging antiviruses and their mechanisms for flagging:
00:11:46FromDiscord<xx_ns> it's quite easy for a binary to be flagged as malicious
00:12:18FromDiscord<Yepoleb> AV vendors just don't care
00:12:25FromDiscord<xx_ns> flagging an already-malicious binary as non-malicious requires reverse engineers at the AV companies to analyze the binary to verify that it is in fact not malicious
00:12:54FromDiscord<xx_ns> it's not that they don't care, i think that's being a bit facetious
00:13:01FromDiscord<xx_ns> they just have a LOT of work
00:13:34FromDiscord<xx_ns> and binaries with more false flag reports are obviously higher prio than the ones with not as much
00:13:47FromDiscord<Yepoleb> I even had a hello world compiled with mingw64 get flagged
00:14:49FromDiscord<xx_ns> yes, because unfortunately for nim, a lot of malware has been written in it, and non-malicious nim binaries also have IoCs identified from the malicious ones
00:15:03FromDiscord<xx_ns> even though those IoCs are not actually genuine indicators of compromise
00:15:10FromDiscord<Yepoleb> Oh, it was not nim, it was C
00:24:07FromDiscord<Yepoleb> If it was just a few random hits with applications that do crazy system and network stuff that would be excusable to me, but flagging every binary made with a certain compiler is incredibly stupid
00:25:59FromDiscord<Yepoleb> If it's impossible to fix the rampant false positives maybe you're approaching things the wrong way
00:26:57PMunchI'm guessing the way it works is that they have some algorithm which generates a fingerprint given sample files. Currently that algorithm is fed with malware written in Nim, and little else. So naturally it finds some commonalities between the binaries which is what Nim does. So it creates fingerprints which targets all Nim programs. If we manage to get some negative samples into the mix this shouldn't happen any longer as the algorithm would no longer
00:26:58PMunchrecognise Nim stuff as just common between viruses.
00:27:37*jmdaemon quit (Ping timeout: 256 seconds)
00:31:15*jmdaemon joined #nim
00:33:49FromDiscord<Elegantbeef> The joke being people release software written in Nim 😛
00:34:01FromDiscord<Elegantbeef> Oh wait not releasing software is a me issue
00:40:12FromDiscord<Rika> In reply to @Yepoleb "If it's impossible to": People will complain about a similar thing if they were rampant with false negatives
00:40:20FromDiscord<Rika> Having a perfect algorithm is impractical
00:40:58PMunchHmm, so apparently my PROGMEM stuff for Ratel doesn't work when it's placed in the global scope..
00:41:21PMunchIs there a way to detect if we're in the global scope or not?
00:43:05FromDiscord<Rika> I assume not
00:47:28NimEventerNew question by pooooky: Nim Table is not updated, see https://stackoverflow.com/questions/71181417/nim-table-is-not-updated
00:55:40FromDiscord<auxym> had a quick look but I can't see the issue with that one
00:57:28FromDiscord<Rika> There isn’t enough info
00:57:45FromDiscord<Rika> Or maybe it has to do with methods, but that would be one hell of a big
00:57:45FromDiscord<Rika> Bug
01:01:56PMunchHmm, someone should have a look at highlight.js. It's not doing a great job highlighting Nim code :P
01:04:45FromDiscord<Rika> I’d say because most of the time they don’t look into how it works and just assume it’s like Python?
01:07:47FromDiscord<Forest> In reply to @Forest "How would i use": Oh yeah, anyone?
01:12:12PMunchtoJs from jsffi perhaps?
01:13:08FromDiscord<huantian> In reply to @Rika "I’d say because most": Wdym Nim is just python with forced typing
01:13:21FromDiscord<Rika> In reply to @huantian "Wdym Nim is just": True
01:16:36*shadow0133 joined #nim
01:19:06*PMunch quit (Quit: leaving)
01:29:55FromDiscord<Forest> In reply to @PMunch "toJs from jsffi perhaps?": Would there be a way to do it in the pragma?
01:33:00*shadow0133 quit (Quit: Client closed)
01:40:27*jmdaemon quit (Ping timeout: 256 seconds)
01:50:20*jmdaemon joined #nim
01:51:10FromDiscord<Forest> :p
02:21:26FromDiscord<Elegantbeef> Pmunch do you have a symbol for your progmem stuff?
02:22:00FromDiscord<Elegantbeef> Checks irc logs and see that he's left the building
02:30:35*jmdaemon quit (Ping timeout: 256 seconds)
02:52:42*arkurious quit (Quit: Leaving)
03:17:40FromDiscord<aph> nimble forgot to close ansi moment https://media.discordapp.net/attachments/371759389889003532/944432522849304636/unknown.png
03:17:43FromDiscord<demotomohiro> @PMunch `owner` proc in macros module might be able to see if the symbol is top level or not.
03:50:16FromDiscord<Arathanis> In reply to @Elegantbeef "https://github.com/saem/vscode-nim#options `nim.pro": I agree with this. Definitely use this one. It is the one with fewer downloads. But is actively mainted. Updated ~20 days ago.↵↵Also when using VS Code for nim I find the following to be vital to the best experience. https://media.discordapp.net/attachments/371759389889003532/944440727960703047/unknown.png
03:50:36FromDiscord<Arathanis> The delay can be whatever you want but I find 200ms gives me the best Intellisense experience.
03:52:42FromDiscord<Arathanis> the nim extension only runs on the on-disk source file instead of the swap file maintained by VS Code so it only sees things when the file is saved. Turning on autoSave greatly improves the experience.
03:56:57*jmdaemon joined #nim
04:06:02*supakeen quit (Quit: WeeChat 3.4)
04:06:31*supakeen joined #nim
04:08:32*rockcavera quit (Remote host closed the connection)
04:12:02FromDiscord<ATwenty0ne> Is there any reason why using stdcall in 32 bit nim doesn’t underscore the function names
04:26:24FromDiscord<huantian> any buitlin func for finding the index of a subseq? this is what I'm doing rn
04:26:40FromDiscord<huantian> https://play.nim-lang.org/#ix=3Q0I
04:27:51FromDiscord<Elegantbeef> `a.find(b)`
04:28:00FromDiscord<huantian> wait that works↵should've checked
04:29:14FromDiscord<Elegantbeef> Why wouldnt it work, seq's have value semantics 😀
04:30:08FromDiscord<huantian> oh wait I'm looking for like the first time certain items appear in a specific order in a seq
04:30:41FromDiscord<Elegantbeef> Ah
04:31:15FromDiscord<Elegantbeef> `if bigSeq[i..i + subSeq.len - 1] == subSeq:` do not do this 😀
04:31:30FromDiscord<huantian> duly noted
04:31:55FromDiscord<Elegantbeef> It's going to allocate a lot of garbage, just iterate the range and check if it matches the subseq
04:32:21FromDiscord<Elegantbeef> I mean i guess if this is a one off dont worry, but if you care about performance that's going to cause a ton of allocations
04:33:40FromDiscord<Elegantbeef> I guess you can do ` if bigSeq.toOpenArray(i, subSeq.high) == subSeq:`
04:34:40FromDiscord<Forest> Does Nim emit ES6 JS code?
04:35:11FromDiscord<Forest> Since don't most, if not all modern browsers use ES6 nowadays?
04:35:12FromDiscord<Elegantbeef> No it emits ES3 iirc
04:35:24FromDiscord<huantian> what's the diff between openArray.high vs openArray.len?
04:35:32FromDiscord<Forest> In reply to @Elegantbeef "No it emits ES3": Ah :/
04:36:01FromDiscord<huantian> ig high gives me nicer syntax highlighting 😛
04:36:03FromDiscord<Elegantbeef> high is len - 1
04:36:08FromDiscord<huantian> ahh
04:36:12FromDiscord<huantian> that's helpful
04:36:40FromDiscord<huantian> why would toOpenArray avoid allocations when slicing doesn't
04:36:59FromDiscord<Elegantbeef> slicing returns a sequence, `toOpenArray` returns an openarray
04:37:15FromDiscord<Elegantbeef> Nim doesnt have viewtypes so you cannot hold onto openArrays yet
04:37:23FromDiscord<Elegantbeef> view types by default\
04:37:49FromDiscord<huantian> hm ok
04:40:20FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Q0K guess `==` doesnt work properly, so there you go
04:40:37FromDiscord<Forest> I don't know how I'm supposed to use more modern features in Nim's JS backend then :|
04:42:02FromDiscord<Forest> I need to port this code (<https://www.toptal.com/developers/hastebin/bukidufoji.typescript>) to Nim but have no idea how to go about it
04:42:12FromDiscord<Forest> Mainly everything involving the class :p
04:46:42FromDiscord<Elegantbeef> I dont follow the issue
04:47:12FromDiscord<huantian> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3Q0K guess `==` doesn": how did it not work properly?
04:47:22FromDiscord<Elegantbeef> It checks if the pointers are equal
04:47:27FromDiscord<huantian> ah
04:47:33FromDiscord<Elegantbeef> Wait nvm it works
04:47:38FromDiscord<Elegantbeef> I just had an issue 😛
04:47:48FromDiscord<huantian> mood
04:50:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Q0M
04:51:44FromDiscord<Elegantbeef> @Forest\: ^
04:54:44FromDiscord<Elegantbeef> `var` might be wrong, but regardless seems close
04:55:32FromDiscord<Forest> Ah okay then, thanks, that makes sense!
04:55:45FromDiscord<Elegantbeef> might not need the `JsObject`
04:58:14FromDiscord<Forest> What does the `importC` do in this case for the type?
04:58:38FromDiscord<Elegantbeef> "Imports compatible"
04:58:59FromDiscord<Elegantbeef> Dont know if `importJs` would work there
05:00:19FromDiscord<Rika> In reply to @Elegantbeef ""Imports compatible"": Not really, it still means import from C
05:02:11FromDiscord<Elegantbeef> Eh import js/cpp are only really for procedures afaict
05:03:13FromDiscord<Rika> I think that’s just because changing what it is would break backwards compatibility so in the future it will be corrected aka 2.0
05:20:29*vicecea quit (Remote host closed the connection)
05:20:57*vicecea joined #nim
05:32:40FromDiscord<Forest> Ah okay
05:36:15FromDiscord<retkid> is there a good way of requesting a url and seeing where it redirects to?
05:37:42FromDiscord<Rika> https://nim-lang.org/docs/httpclient.html#redirects
05:37:45FromDiscord<Rika> Then get
05:37:58FromDiscord<Rika> The response should have where it redirects to
05:38:25FromDiscord<retkid> ahhhh
05:39:05*slowButPresent quit (Quit: leaving)
05:43:21FromDiscord<retkid> In reply to @Rika "The response should have": yea its not in the headers
05:43:26FromDiscord<retkid> i dont know where else it would be?
05:43:31FromDiscord<retkid> bodyStream?
05:43:38FromDiscord<Rika> Yes afaik
05:43:57FromDiscord<Rika> It’s in the body and the status code should say it’s a redirect
05:44:16FromDiscord<retkid> status code is 200
05:44:34FromDiscord<retkid> but in the body is just the html of the page?
05:44:45FromDiscord<retkid> i need the url that it went to
05:45:02FromDiscord<Rika> Eeh really now
05:45:09FromDiscord<Rika> What is in the body
05:45:26FromDiscord<Rika> If there’s a node with a reload attribute that’s a redirect
05:45:47FromDiscord<Rika> Like “<meta http-equiv="Refresh" content="0; url='https://www.w3docs.com'" />”
05:45:49FromDiscord<retkid> in the stream?
05:45:50FromDiscord<Rika> I copied this
05:45:52FromDiscord<retkid> ah
05:48:06FromDiscord<Rika> I’m not sure if Nim follows those redirects though tbh
06:03:22*Gustavo6046 quit (Quit: Leaving)
06:32:34FromDiscord<Forest> Is there a way i could completely override existing Nim procs?
06:32:55FromDiscord<Forest> I don't want to use the existing ones because they're just incompatible with the environment I'm using so
06:33:18FromDiscord<Elegantbeef> if they're in system it's a bit annoying, otherwise yes just write your variant
06:37:10FromDiscord<Forest> Alright 👍
06:52:51*krux02 quit (Remote host closed the connection)
07:28:37FromDiscord<Bung> It seems std httpclient can't download attachment? it shows parse http error during parsing header
08:16:04FromDiscord<haolian9 (高浩亮)> could you provide a minimal code to reproduce and exact error info? it-ok-on-my-machine™
08:50:46FromDiscord<Bung> https://github.com/bung87/cp_invoice
08:52:36FromDiscord<Bung> I use this download file from clipboard, you tried the url pass to download is a attachment in browser ?
08:53:23FromDiscord<Bung> maybe it only occurs on some http server
08:55:19FromDiscord<Bung> error is `Exception message: invalid http version, `Ⱦ�;��N�L�dD�� wu��0΀&+��,��9��m����� ���"�?�]�``
09:01:23*jjido joined #nim
09:34:09*Abrax joined #nim
09:34:23Abraxah i see
09:35:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:44:13FromDiscord<Nabulec> sup
09:45:22FromDiscord<Elegantbeef> Hello
09:47:19nrds<Prestige99> sup Beef
09:47:54FromDiscord<Elegantbeef> Nothing as usual
09:49:01FromDiscord<Nabulec> do you use the reactiflux discord-irc bridge
09:55:36FromDiscord<Rika> No
09:55:41FromDiscord<Rika> It’s a custom made bridge
10:08:32FromDiscord<haolian9 (高浩亮)> as the header part was binary format, i think the server do not speak http/1.\, maybe http/2?↵(@Bung)
10:09:05FromDiscord<haolian9 (高浩亮)> std/httpclient does not work with http/2, is it correct?
10:09:18FromDiscord<Rika> Yes
10:09:30FromDiscord<Rika> Nim doesn’t have much for 2 yet
10:09:37FromDiscord<Rika> Neither a client nor a server I believe
10:09:54FromDiscord<Rika> Though when it comes to 2, it should start with a 1.1 upgrade
10:09:58FromDiscord<Rika> So it might be 3?
10:11:05FromDiscord<Rika> Ah can’t be 3 since that runs over UDP and QUIC
10:12:08*pro joined #nim
10:13:14FromDiscord<haolian9 (高浩亮)> thanks!
10:13:20*Vladar joined #nim
11:01:32*gsalazar quit (Ping timeout: 272 seconds)
11:03:26*ltriant quit (Ping timeout: 256 seconds)
11:07:01FromDiscord<gdquest> Hey people, just wanted to say we finished our first sizeable Nim project, it's a build system and formatter that's really specialized - it formats and builds markdown lessons to teach the Godot game engine. And we've had a great experience with the language
11:07:51FromDiscord<enthus1ast> 👍️
11:07:57*pro quit (Ping timeout: 240 seconds)
11:09:01FromDiscord<gdquest> We wrote a partial markdown parser (block parser, because we don't need the full AST), formatter for prose, and my teammate wrote the build system and rewrote the formatter after a first iteration I made.↵Actually, the build system's code is now smaller than before, when we used Python and Scons - it's smaller without the framework!
11:09:21FromDiscord<gdquest> If anyone's curious it's all MIT-licensed, available here, in the src/ directory: https://github.com/GDQuest/product-packager/
11:10:54FromDiscord<gdquest> The only thing my teammate couldn't get to work yet is running sub-processes/command-line commands in parallel with `execCmdEx()`
11:11:11FromDiscord<gdquest> We saw that `weave` library for multithreading, but didn't get to try it yet.
11:11:46FromDiscord<enthus1ast> i think you should use startProcess for this
11:12:16FromDiscord<Rika> Weave isn’t for subprocess execution
11:12:36FromDiscord<enthus1ast> startProcess with poEvalCommand option
11:13:48FromDiscord<gdquest> Gotcha regarding weave. And thanks, we'll look into that proc.
11:16:11*pro joined #nim
11:16:42FromDiscord<enthus1ast> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: i tried emacs (again), but it just killed me with being a complete other world, BUT i gave nvim another try for programming this time it could maybe replace vscode for me
11:16:53FromDiscord<enthus1ast> have to say i'm on windows
11:18:36FromDiscord<enthus1ast> since i mostly work on windows these days all the good stuff requires double the amounth of work unfortunately
11:19:20FromDiscord<Rika> Why do you want a replacement for VSC
11:19:46FromDiscord<enthus1ast> just curios and i use vim quite often for admin work already
11:20:03FromDiscord<Rika> Okay
11:20:27FromDiscord<Rika> Yeah people joke about vim being hard to exit, LOL try fucking exiting emacs
11:20:40FromDiscord<Rika> Shit is nigh impossible to do for me
11:20:49FromDiscord<haxscramper> IMO emacs keybindings are unusable as well
11:21:01FromDiscord<haxscramper> But it does emulate vim better than vim itself, so
11:22:17FromDiscord<enthus1ast> i'm still waiting for good nim tooling unfortunately \:/
11:22:22FromDiscord<Rika> It does? How so
11:22:32FromDiscord<haxscramper> evil-mode
11:22:45FromDiscord<Rika> I know of it but that explains nothing about emulating better
11:23:36FromDiscord<gdquest> In reply to @haxscramper "But it does emulate": That's the reason I use it. Not evil-mode itself but the experience you get in vim mode overall
11:23:37FromDiscord<haxscramper> For me it is more usable than configuring and using vim
11:24:02FromDiscord<Rika> I don’t follow
11:24:13FromDiscord<haxscramper> I like it better
11:24:14FromDiscord<gdquest> A big selling point is doom emacs, or spacemacs for those who prefer it - they do the hard config work for you, and you don't have something as polished for vim
11:24:17FromDiscord<haxscramper> simple enough?
11:24:24FromDiscord<Rika> Okay
11:25:15FromDiscord<gdquest> For me editing wise the nice thing is you get hybrid input with evil-mode - you can use Ctrl backspace and all the basic text editing shortcuts out of the box
11:25:32FromDiscord<Rika> I’ve already done my config work and if ever I need a plugin I’d much rather program it in Lua than Lisp….
11:25:36FromDiscord<gdquest> Or copy to the system clipboard by default, save with Ctrl S and all
11:25:49FromDiscord<gdquest> Yeah so a configured nvim is just as good
11:26:04FromDiscord<haxscramper> emacs allows you to write configuration in C, and nim compiles to C
11:26:11FromDiscord<haxscramper> so I can write my configuration in nim
11:26:22FromDiscord<Rika> I wouldn’t like to write my config in C
11:26:22FromDiscord<haxscramper> which, by definition, beats all other options
11:26:24FromDiscord<Rika> Or Nim
11:26:33FromDiscord<haxscramper> depends on what do you put in your "config"
11:26:40FromDiscord<gdquest> The last thing I really love is native compilation of lisp, when you use loads of plugins with the latest version it stays blazing fast
11:26:49FromDiscord<haxscramper> I just write a shortcut that transposes two operands of infix expression
11:26:56FromDiscord<gdquest> Vscode gets really slow as you add plugins
11:26:57FromDiscord<haxscramper> using tree-sitter parser
11:27:04FromDiscord<Rika> And I assume nvim has this option too…
11:27:16FromDiscord<haxscramper> I consider it a "config", but I don't think a lot of people spend time on this
11:27:20FromDiscord<enthus1ast> wait what you write your emacs config in nim \:)
11:27:23FromDiscord<enthus1ast> awesome
11:27:52FromDiscord<gdquest> Awesome I dunno but must say, using lisp to configure anything is really the not so great part of emacs
11:28:41FromDiscord<gdquest> The language is... fine, it's imperative, but it feels a bit dated and bloated (lots of deprecated functions you have to learn not to use)
11:29:01FromDiscord<haxscramper> the language is garbage
11:29:29FromDiscord<gdquest> The vast majority of languages are if you take it like that
11:29:49FromDiscord<haxscramper> the idea/framework around it is good, but I can't see myself writing anything complext in dynamically typed&scoped language. nim is better and can be as concise as I need
11:29:51FromDiscord<gdquest> Also in general, using imperative code to configure a program sucks, one error can prevent loading or break stuff
11:30:17FromDiscord<haxscramper> In reply to @gdquest "The vast majority of": yeah, I'm on a more pessimistic side of the language evaluation most of th etime
11:30:58FromDiscord<haxscramper> also with nim I can pull in all the C libs into my things, and god knows what I can do then
11:30:58FromDiscord<gdquest> When I say fine, if I'm gonna write code to configure a program, I'd rather have something like nim too
11:31:33FromDiscord<gdquest> but also hassle-free, tightly integrated, with excellent linting if possible
11:31:48FromDiscord<gdquest> Well gotta tap out, ttyl!
11:35:00FromDiscord<Rika> well i dont know, im not a fan of "super configs" like doom/space-xxx so most of my config/plugins are self derived or searched for
11:35:18FromDiscord<Rika> i dont know how good the integration of evil mode is with any other plugins
11:35:24FromDiscord<Rika> i dont want to deal with lisp ever
11:35:31FromDiscord<Rika> eh
11:37:17FromDiscord<haxscramper> In reply to @Rika "well i dont know,": They provide a baseline experience, and you can configure things on top
11:37:52FromDiscord<haxscramper> In reply to @Rika "i dont want to": On this part I agree - for anything more complex than `a = b` it is very annoying
11:37:58FromDiscord<haxscramper> and even `a = b` is annoying
11:57:18*ltriant joined #nim
12:02:05*ltriant quit (Ping timeout: 256 seconds)
12:06:01*supakeen quit (Quit: WeeChat 3.4)
12:06:30*supakeen joined #nim
12:07:19FromDiscord<Rika> In reply to @haxscramper "They provide a baseline": i usually do not want that base experience, it is usually old or outdated
12:12:37*jmdaemon quit (Ping timeout: 256 seconds)
12:16:30FromDiscord<haolian9 (高浩亮)> regarding to tree sitter and nvim, i found https://github.com/haxscramper/tree-sitter-nim, but i havent gave it a try
12:16:54FromDiscord<haxscramper> it doesn't work
12:17:06FromDiscord<haxscramper> writing nim parser for tree-sitter turned out a lot more complicated that I can manage
12:18:09FromDiscord<haxscramper> so unless there is a tree-sitter expert that is willing to give it a push (with all the syntax elements like nested comments, indentation, UFCS, commmand syntax etc.) I don't think we can get this for nim
12:18:42FromDiscord<haolian9 (高浩亮)> anyway, thanks; treesitter and treesitter-refactor is just great
12:43:49FromDiscord<aph> sent a code paste, see https://paste.rs/epL
12:55:20*PMunch joined #nim
13:01:23FromDiscord<Rika> it is likely the integer size thing i assume; if so, then your C compiler and Nim do not agree on how big an `int` is
13:01:31FromDiscord<Rika> or rather how big a pointer is, afaik
13:02:32FromDiscord<aph> hmm
13:06:58FromDiscord<aph> seems like i need an updated version of gcc
13:15:57*krux02 joined #nim
13:16:17*slowButPresent joined #nim
13:32:36PMunchArgh, this is driving me nuts!
13:35:02FromDiscord<auxym> the global progmem thing?
13:36:38PMunchYup
13:37:12PMunchNim insists on creating nimZeroMem even though it's codegenDecl, noInit, and cimport...
13:37:21PMunchimportc*
13:38:42PMunchEureka!
13:38:53PMunchIt seems like attaching "global" did it!
13:39:28PMunchSince these are generated from inside a template anyways they will all have unique symbols
13:39:34PMunchSo that's not an issue
13:40:02PMunchHmm, maybe I should try to make it a macro and generate the temporary name based on the content
13:40:29PMunchThat way if you did `p"Hello world"` one place and then `p"Hello world"` another place in your code they should both bind to the same symbol
13:50:08PMunchWell that worked surprisingly well
13:50:46PMunchHad to throw on a small `when not declared` around the declaration, so I think this would only make it module-local but that should be fine
13:50:54PMunchI guess I could also keep a compile-time table
14:00:17*kayabaNerve_ quit (Ping timeout: 240 seconds)
14:03:51*kayabaNerve joined #nim
14:07:19PMunchHmm, when working with raw string literals, is there a good way to get the length it would be when parsed by C?
14:10:33*arkurious joined #nim
14:12:27FromDiscord<haxscramper> they are codegened into the structure that contains length
14:12:45PMunchHuh?
14:12:48FromDiscord<haxscramper> `NimStrLit` or something similar, so there is an explicit `.len` field in the code
14:13:29FromDiscord<haxscramper> `STRING_LITERAL(TMyyMRi7JdIWcRPn9b9bzYA6TQ_3, "123123313", 9);`
14:13:34PMunchAh yes, but say I have a string `"Hello world\n"` which I pass to my macro `p` as `p"Hello world\n"`
14:14:28PMunchThat literal is now 13 bytes long, even though the string it represents is only 12 bytes long because the two characters of the escape sequence represents a single character
14:14:50FromDiscord<haxscramper> then subtract number of `\` in the sequence
14:14:56FromDiscord<haxscramper> in the string
14:15:06PMunchWell then \\ misbehaves
14:15:40PMunchAnd \n on Windows I guess, since that creates CRLF
14:15:49FromDiscord<haxscramper> then more heuristics
14:16:00FromDiscord<haxscramper> `when defined(windows)` in the macro code
14:16:55FromDiscord<haxscramper> The "ength it would be when parsed by C?" is answered by codegen, everything else must be computed manually
14:17:39FromDiscord<haxscramper> Because `p"XXX"` is a raw string literal, so the C one would be `XXX\\n`, but you are doing some intermediate magic, so you need to account for that yourself
14:18:04PMunchJust to explain what I'm doing, I need to `codegenDecl` a string, but I want to put that into a type with a static length field
14:18:21PMunchThe static length field and the length that C sees the string as has to agree
14:18:23FromDiscord<haxscramper> If you just write `r"test\n"` it's len is 6
14:18:44FromDiscord<auxym> does "\n" really expand to CRLF in nim on windows? I thought that was \p (platform-specific line ending)
14:19:06PMunchThe problem is that now I can do `p"Hello world"` and `p("Hello world")`, both are those are valid, and I have no way of telling them apart
14:19:20PMunch@auxym, I believe it was changed around 0.20.0
14:19:27FromDiscord<haxscramper> does `arg.strVal.len()` work?
14:19:37PMunchAnd no way to know which is which and how long the string is
14:20:00PMunchWell it's `macro p(x: static[string]): untyped` so I don't really have a NimNode
14:22:46FromDiscord<haxscramper> prints 6 and 5
14:22:47FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Q3e
14:23:05PMunchI know
14:23:10PMunchI want 5 from both of them
14:23:27PMunchHmm, I think I have a solution
14:23:48FromDiscord<haxscramper> that would go against the main language semantics
14:24:09FromDiscord<haxscramper> in nim `X"str"` means raw string literal, and it is expected to be different from `X "str"`
14:24:24FromDiscord<haxscramper> I don't even think there is a need to hack around that
14:24:45FromDiscord<haxscramper> maybe you can get something like `callsite()` working
14:24:49FromDiscord<haxscramper> in theory
14:25:20FromDiscord<haxscramper> yeah callsite works
14:26:01PMunchcallsite and read the code from the file?
14:26:12FromDiscord<haxscramper> and varargs untyped
14:26:23FromDiscord<haxscramper> callsite is deprecated
14:26:30FromDiscord<haxscramper> I mean, it is a RStrLit if you drop static
14:26:48PMunchI don't really need to work around it, I just want to detect it so I can act accordingly
14:26:51FromDiscord<haxscramper> if you don't drop static, it is, by definition, impossible to do what you want to do IMO
14:27:01PMunchYeah I realised
14:27:16FromDiscord<haxscramper> callsite is deprecated since 0.18 and it returns the code of the whole macro call
14:27:29PMunchChanging it to type and then checking whether or not it is a string literal node works
14:43:47PMunchI mean the problem is that if I get a raw string literal and then send that to C via codeGenDecl then C will interpret the string and un-raw it
14:45:09*ltriant joined #nim
14:45:18FromDiscord<haxscramper> what codegendecl are you creating?
14:45:43PMunchAs of now it is `codegenDecl: "static const $# $# PROGMEM = (\"" & `x` & "\")"`
14:46:57FromDiscord<haxscramper> `.strVal()` of the raw string literal is `\\n`, right? So it would be a `\"" & "test\\n" & "\"`
14:46:58FromDiscord<haxscramper> or not
14:48:24PMunchYes it is \\n in Nim, which means the generated code for `p"test\n"` is `static const $# $# PROGMEM = ("test\n")`
14:49:53PMunchWhich is kinda wrong seeing how `p""` should really be considered to be a raw string literal
14:50:23*ltriant quit (Ping timeout: 256 seconds)
14:52:57FromDiscord<haxscramper> have you actually looked at the generated code?
14:53:08PMunchYup
14:53:14FromDiscord<haxscramper> I just tested, and `p"test\n"`'s `.strVal()` is `\\n`
14:53:23FromDiscord<haxscramper> so how does it end up with `\n`
14:53:35PMunchBecause of codegenDecl
14:53:55PMunch\\n in Nim is the two character \ and n, that gets inserted verbatim into the C code as \n
14:53:59FromDiscord<haxscramper> have you tried double escaping everything?
14:54:21PMunchWhat do you mean by double escaping?
14:55:53FromDiscord<haxscramper> double escaping? escaping every escape character again
14:56:13PMunchAh, no I haven't tried that
14:56:48PMunchThe problem is that I need C-compatible escaping
14:58:12FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Q3x
14:58:15FromDiscord<haxscramper> generates this `static const NCSTRING a_asdf_28 = ("test\\n");`
14:58:23FromDiscord<haxscramper> you need something different, right?
14:59:13FromDiscord<haxscramper> Interpolating macro argument in quote do also generates `\\n` in the c code
14:59:24FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Q3y
14:59:25FromDiscord<haxscramper> `static const NCSTRING aX60gensym0asdf_13 = ("test\\n");`
15:12:13*averell quit (Remote host closed the connection)
15:13:58PMunchOkay, I just nicked the makeCString procedure from the compiler
15:14:02PMunchThat should hopefully be correct :P
15:16:14*Gustavo6046 joined #nim
15:29:20FromDiscord<kiell> whats the difference between object and rootobj?
15:32:22*neurocyte0917090 joined #nim
15:50:51*ltriant joined #nim
15:52:32*neurocyte0917090 quit (Quit: The Lounge - https://thelounge.chat)
15:54:47FromDiscord<Forest> Does Nim have a fast pure JSON parser that's compatible with the JS backend?
15:55:01FromDiscord<Forest> Or should i just use SJFFI to require the JSON file? :P
15:56:02*ltriant quit (Ping timeout: 272 seconds)
15:56:29FromDiscord<Forest> (edit) "SJFFI" => "JSFFI"
15:57:44*neurocyte0917090 joined #nim
16:00:12*pro quit (Ping timeout: 240 seconds)
16:11:17FromDiscord<planetis> you can use this https://github.com/karaxnim/karax/blob/master/karax/jjson.nim
16:15:56FromDiscord<pietroppeter> In reply to @Forest "Does Nim have a": https://github.com/nitely/nim-regex
16:29:14FromDiscord<retkid> so
16:29:27FromDiscord<retkid> i need my httpclient to have the same cookies as my browser
16:29:30FromDiscord<retkid> how do i set that uP?
16:29:49FromDiscord<Rika> Manually.
16:29:53FromDiscord<retkid> where tho
16:30:00FromDiscord<Rika> You can set cookies
16:30:17FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/944631991532396584/unknown.png
16:30:21FromDiscord<Rika> Oh wait I’m brain broken
16:30:27FromDiscord<Rika> Cookies are sent as headers on request
16:30:47FromDiscord<Rika> Manually manage them (I guess)
16:30:58FromDiscord<Rika> You can just make a string table
16:31:01FromDiscord<retkid> yea
16:31:11FromDiscord<retkid> uhhh
16:31:13FromDiscord<retkid> shit
16:31:21FromDiscord<retkid> whats the format for it do you have an example?
16:31:33FromDiscord<Rika> Header that is set https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie
16:31:54FromDiscord<Rika> https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
16:32:06FromDiscord<retkid> so i mean the nim syntax
16:32:20FromDiscord<retkid> (edit) "so" => "no"
16:32:24FromDiscord<retkid> im finding the cookie i need nowe
16:32:25FromDiscord<Rika> If you want to keep all of the other metadata then type
16:32:30FromDiscord<retkid> (edit) "nowe" => "now"
16:32:39FromDiscord<Rika> In reply to @retkid "no i mean the": It’s a table what’s there to say?
16:32:48FromDiscord<Rika> I’m unsure what you mean now
16:32:53FromDiscord<Rika> The flow will be like this
16:33:28FromDiscord<Rika> Define a table for your cookies↵set the key value↵On request, set the cookie header and convert the table into the format given above
16:33:45FromDiscord<Rika> That’s the basic naive flow
16:34:08FromDiscord<Rika> If you need expires and other stuff then you’d probably go into custom type for your value territory
16:34:38FromDiscord<Rika> Then manage expires and stuff, session only cookies don’t matter since you lose them all on restart anyway unless you also implement serialisation, etc
16:35:10FromDiscord<Rika> The procs you need to define is basically the one that converts it into the header format given the Nim table of cookies
16:35:22FromDiscord<Rika> I have to sleep
16:36:16FromDiscord<enthus1ast> @retkid\: have a look at this lib, this can handle cookies\: https://github.com/enthus1ast/nimNimiBrowser
16:37:24FromDiscord<enthus1ast> https://github.com/enthus1ast/nimNimiBrowser/blob/6ff84c95fea73a758f762a255f4a424509fe3fe1/src/nimibrowser.nim#L49↵https://github.com/enthus1ast/nimNimiBrowser/blob/6ff84c95fea73a758f762a255f4a424509fe3fe1/src/nimibrowser.nim#L82
16:37:43FromDiscord<Rika> What is this lol interesting
16:37:51FromDiscord<Rika> Is that an actual browser from scratch or so!
16:37:52FromDiscord<Rika> ?
16:37:56FromDiscord<enthus1ast> naah
16:38:08FromDiscord<enthus1ast> a client lib that i use for crawling mostly
16:38:21FromDiscord<enthus1ast> it does automatic cookie handling and decompression
16:38:53FromDiscord<enthus1ast> and have a proc that parses http headers, so that i can just copy and past from burp mitm proxy
16:39:50FromDiscord<retkid> @Rika it is late, take care!
16:39:59FromDiscord<enthus1ast> g8 @Rika
16:40:35FromDiscord<retkid> In reply to @enthus1ast "<@217459674700578816>\: have a look": so with this i can steal some of the functions from it and just use the cookies from firefox?
16:41:12FromDiscord<enthus1ast> i mean, a "cookie" is just a line in the request header
16:41:46FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/944634878161469510/unknown.png
16:41:54FromDiscord<retkid> they would be the value guys, right?
16:42:11FromDiscord<enthus1ast> i recommend burp for this
16:42:24FromDiscord<retkid> i cannot burb i have no co2 in my tummy
16:42:51FromDiscord<retkid> (edit) "burb" => "burp"
16:42:59FromDiscord<retkid> ("what is burp")
16:43:22FromDiscord<enthus1ast> burp is a man in the middle proxy
16:43:37FromDiscord<retkid> alright how do i implement that in nim
16:43:52FromDiscord<retkid> ah
16:43:58FromDiscord<retkid> i just need to make one i think
16:45:38FromDiscord<enthus1ast> sent a long message, see http://ix.io/3Q4k
16:45:55FromDiscord<enthus1ast> if you know what to send, you do not need burp
16:46:09FromDiscord<retkid> yea im 99% sure its one of these two proxies
16:46:17FromDiscord<retkid> (edit) "proxies" => "cookies"
16:46:41FromDiscord<retkid> In reply to @enthus1ast "no i mean, i": what is "burps browser"
16:48:36FromDiscord<enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/944636599671590992/image.png
16:49:32FromDiscord<enthus1ast> a browser (chrome) that is preconfigured for man in the middle
16:49:44FromDiscord<retkid> i mean
16:49:48FromDiscord<retkid> i just found the headers firefox used
16:52:21FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=3Q4n
16:53:13FromDiscord<enthus1ast> i think cps has a goto example
16:53:29FromDiscord<enthus1ast> but can you not just use a loop?
16:53:39FromDiscord<retkid> i got it working :)
16:54:03FromDiscord<Goel> I just want to know if Blocks allows it or not, i don't need it
16:54:26FromDiscord<retkid> if you want you can do it like this
16:54:29*neurocyte0917090 quit (Ping timeout: 256 seconds)
16:55:43FromDiscord<retkid> or you can use templates for less pasta
16:55:44FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Q4s
16:55:47FromDiscord<retkid> (edit) "pasta" => "spaghetti"
16:56:50FromDiscord<enthus1ast> o.0
16:56:53FromDiscord<Goel> I DONT need it, it was just for knowledge sake, nothing else. I just wanted to know if Block have something that may it recall a Block like that. The answer seems to be not, fine. 😄
16:57:26FromDiscord<Forest> In reply to @planetis "you can use this": Thanks!
16:57:38FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Q4t
16:57:39FromDiscord<retkid> In reply to @Goel "I DONT need it,": ikik
16:57:45FromDiscord<retkid> im just giving goto like things
16:58:06FromDiscord<retkid> tmk theres no goto in nim
16:58:34PMunch@Goel, Nim doesn't have a goto statement, but you can `break myBlock`
16:58:38PMunchTo exit it early
17:00:53FromDiscord<retkid> also i was wondering with the html parser is there anyway to search by class
17:01:25FromDiscord<retkid> or maybe make it more convenient to search when im 50 divs in
17:01:38FromDiscord<enthus1ast> you could use "q" https://github.com/OpenSystemsLab/q.nim
17:07:36FromDiscord<enthus1ast> but for most of the websites out there, you must clean the html first
17:08:12FromDiscord<enthus1ast> or, like araq mentioned lately in the forum, tokenize the html
17:10:32*pro joined #nim
17:10:47FromDiscord<enthus1ast> https://forum.nim-lang.org/t/6179
17:11:03FromDiscord<retkid> im workin with q
17:12:23FromDiscord<retkid> its very cool
17:12:24FromDiscord<retkid> i love it
17:12:39FromDiscord<retkid> though more classes would be cool its a bit odd just putting a string into something like this
17:12:43FromDiscord<retkid> echo doc.select("table.style-01 tr td")
17:12:50FromDiscord<retkid> (edit) "echo doc.select("table.style-01 tr td")" => "sent a code paste, see https://play.nim-lang.org/#ix="
17:13:01FromDiscord<retkid> reminds me of bash
17:14:25FromDiscord<enthus1ast> what do you mean?
17:15:20FromDiscord<retkid> its kinda like the DB stuff
17:15:24FromDiscord<retkid> its all untyped just strings
17:15:27FromDiscord<retkid> y'know
17:17:23FromDiscord<enthus1ast> webcrawling always is dirty business
17:17:52FromDiscord<enthus1ast> if you're lucky the website exposes a json / rest api
17:18:27FromDiscord<retkid> lol
17:18:30FromDiscord<retkid> this is true
17:18:50FromDiscord<retkid> anything involving the web is still the wild west 30 someodd years later
17:20:37FromDiscord<haolian9 (高浩亮)> sent a code paste, see https://play.nim-lang.org/#ix=3Q4D
17:35:56*noeontheend joined #nim
17:37:05FromDiscord<enthus1ast> [haolian9 (高浩亮)](https://matrix.to/#/@haolian9-56e3c49285d51f252ab86990:gitter.im)\: seems not, only for HttpHead, HttpConnect
17:37:07FromDiscord<enthus1ast> https://github.com/nim-lang/Nim/blob/7994556f3804c217035c44b453a3feec64405758/lib/pure/httpclient.nim#L1055
17:45:06*jjido joined #nim
17:48:17FromDiscord<haolian9 (高浩亮)> thanks, i just found the private property `HttpClient.getBody: bool` which is used to implement `httpclient.downloadFile`; sadly, it's private
17:51:06FromDiscord<haolian9 (高浩亮)> oh, it also occurs where you have pointed out.
17:53:40FromDiscord<Forest> Is it possible to suppress certain things that are 'unused'?
17:57:57FromDiscord<huantian> Check out the used pragma
18:04:48*jmdaemon joined #nim
18:05:07FromDiscord<System64 ~ Flandre Scarlet> is it normal the ``>>`` operator doesn't work?
18:05:45FromDiscord<huantian> Define doesn’t work
18:05:51FromDiscord<haxscramper> `shr`
18:06:07FromDiscord<System64 ~ Flandre Scarlet> ah thanks
18:06:13FromDiscord<haxscramper> `shr` and `shl` for right and left shift, `a = a shr X` for `<<=`
18:06:18FromDiscord<haxscramper> (edit) "shr" => "shl"
18:09:40*noeontheend quit (Ping timeout: 272 seconds)
18:13:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @haxscramper "`shr` and `shl` for": Ah thanks
18:13:57FromDiscord<System64 ~ Flandre Scarlet> I'm used to the C synthax lol
18:14:00FromDiscord<System64 ~ Flandre Scarlet> (edit) "synthax" => "syntax"
18:16:24FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Q4Y
18:18:02FromDiscord<Forest> In reply to @huantian "Check out the used": How would i use it on imports?
18:19:24FromDiscord<Forest> Also I can't find information on it
18:25:19*ltriant joined #nim
18:29:20FromDiscord<huantian> https://nim-lang.org/docs/manual.html#pragmas-used-pragma
18:39:03FromDiscord<retkid> A wise man once told me
18:39:15FromDiscord<retkid> “ anything has an API if you try hard enough”
18:40:08FromDiscord<retkid> This has been true for everything besides twitch who’s site is web generated and confusing so you need to use their official apis or figure out patterns in the random garbage they spit out
18:40:22FromDiscord<retkid> Idk why I’m saying this here
18:52:37arkanoidmy compilation is failing on assert "NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");" in nimbase.h
18:53:08arkanoidwhat does it mean? I'm trying to compile i386 code in x86_64, so I'm using switch("cpu", "i386")
19:05:08FromDiscord<lpha3ch0> sent a code paste, see https://play.nim-lang.org/#ix=3Q5j
19:18:20*noeontheend joined #nim
19:20:18*pro quit (Quit: pro)
19:22:17*noeontheend quit (Ping timeout: 240 seconds)
19:25:48FromDiscord<lpha3ch0> sent a code paste, see https://play.nim-lang.org/#ix=3Q5m
19:35:24*Vladar quit (Quit: Leaving)
19:42:09FromDiscord<haxscramper> @lpha3ch0 If you don't want to paste full filenames you can also run with `--filenames=canonical`, it will show paths relative to the project/package root
19:42:18FromDiscord<haxscramper> I mean the `[redacted]` part
19:44:57*Gustavo6046 quit (Ping timeout: 240 seconds)
19:56:38*Gustavo6046 joined #nim
19:59:35*Gustavo6046_ joined #nim
20:02:29*Gustavo6046 quit (Ping timeout: 252 seconds)
20:21:14*jmd_ joined #nim
20:21:29*jmdaemon quit (Read error: Connection reset by peer)
20:25:26FromDiscord<Waldecir Santos> Why don't nim convert ints "transparently" I'm passing a int to an argument and it's complaining because it expects int32, I understand if we are going from int32>=->int we can loose that, but the other way makes no sense to me, any idea ?
20:35:36FromDiscord<enthus1ast> you could define a converter
21:00:01FromDiscord<demotomohiro> Passing int to int32 lose bits. int is 64bit in 64bit cpu.
21:05:49FromDiscord<demotomohiro> @arkanoid You probably using GCC for x86_64. You need to install or configure gcc to output executable for i386 CPU.
21:09:23FromDiscord<Phil> Finally able to find some time to write nim code again... tomorrow
21:34:22*Gustavo6046_ quit (Quit: Leaving)
21:34:43*Gustavo6046 joined #nim
23:41:05FromDiscord<Waldecir Santos> In reply to @demotomohiro "Passing int to int32": True forgot about cpu arch.