<< 31-10-2021 >>

00:40:22*krux02 quit (Remote host closed the connection)
00:59:46*Vladar quit (Quit: Leaving)
02:37:09FromDiscord<RattleyCooper> Anybody have any luck cross compiling for windows from a raspberry pi?
02:38:00FromDiscord<RattleyCooper> I'm getting an unrecognized command line option `-mno-ms-bitfields` when I use `-d:mingw`:
02:38:06FromDiscord<RattleyCooper> (edit) "`-d:mingw`:" => "`-d:mingw`"
02:39:39FromDiscord<RattleyCooper> scratch that, I just forgot the `--cpu`
02:40:19FromDiscord<IsaacPaul> yea nim still thought it was building for windows
03:03:38*neurocyte0132889 quit (Ping timeout: 268 seconds)
03:04:27*rockcavera quit (Remote host closed the connection)
04:03:18*nrds joined #nim
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:27:09*arkurious quit (Quit: Leaving)
05:15:55FromDiscord<evoalg> I was looking at "swap" and from my tests doing "swap(a, b)" is the same as doing "(a, b) = (b, a)" and from my time tests they are just as fast as each other. Is it ok for me to use either, or are there reasons I might want to use swap sometimes?
05:16:29FromDiscord<Rika> personal choice
05:16:32FromDiscord<Rika> less to type?
05:16:38FromDiscord<Rika> more explicit? idk
05:17:11FromDiscord<evoalg> gotcha ok thank you ... I just wanted to make sure I wasn't missing some point behind it ... all good!
05:17:16FromDiscord<Elegantbeef> Did you test with a release or debu build?
05:17:39FromDiscord<evoalg> I did -d:release ... what is "debu"?
05:17:43FromDiscord<Rika> debug
05:17:53FromDiscord<Elegantbeef> me fucking up
05:17:59FromDiscord<Rika> haha beef is chubby
05:18:08FromDiscord<evoalg> hehe
05:18:26FromDiscord<Rika> ~~debu is chubby in an unspecified language i know of~~
05:36:21FromDiscord<evoalg> I know the release does more checks than danger, but being the noob I am, I'm assuming that debug mode does more checks then "-d:release" ? ... but I'm not sure?
05:37:33FromDiscord<evoalg> actually I seem to remember someone saying a stacktrace will be printed out for debug mode whereas it might not be for release ... ok!
05:38:12FromDiscord<evoalg> In reply to @Rika "ah, run without -d:release": Thank you
05:38:32FromDiscord<Rika> lol
05:38:57FromDiscord<Rika> if you want some speed with stacktraces you can just use --opt:speed instead of -d:release
05:39:51FromDiscord<evoalg> ahhh nice ... that isn't on by default because maybe it slows compilation time I guess
05:40:19FromDiscord<Rika> yes
05:49:26FromDiscord<huantian> what does the `-g` flag do for the nim compiler? I couldn't find it on the docs
05:53:09FromDiscord<huantian> also, what are the "active boot switches" that show up when I do `nim -v`?
06:08:36FromDiscord<Elegantbeef> -v shows what it was built with
06:09:29FromDiscord<Rika> -g is probably a switch for --debugger:native
06:10:17FromDiscord<Rika> it is undocumented though
06:26:48*vicfred quit (Quit: Leaving)
07:05:09FromDiscord<baalajimaestro> Hi, is shell dsl the only way for executing shell commands?
07:06:15FromDiscord<Elegantbeef> `std/os` and `std/osproc` also allows you to
07:06:39FromDiscord<baalajimaestro> hmm, okay
07:08:02FromDiscord<baalajimaestro> is there some package that can handle git? Like gitpython
07:08:30FromDiscord<baalajimaestro> I tried googling each of these and mostly land on `vim` suggestions without being a vim user
07:08:41FromDiscord<Elegantbeef> I dont know if there is a high level package but there is libgit bindings
07:10:16FromDiscord<baalajimaestro> ah nimgit2 seems like enough, i can figure out how to work with it
08:46:03FromDiscord<sealmove> How does `nim e` work? Does it compile Nim into some kind of bytecode?
08:48:17FromDiscord<haxscramper> Yes, it runs nim in the VM
08:48:19FromDiscord<haxscramper> Register-based VM
08:48:32FromDiscord<haxscramper> Same one that is used for the macro evaluation and other things
08:54:08FromDiscord<sealmove> Can I see the bytecode somehow?
08:54:47FromDiscord<Elegantbeef> Well the compiler is open source so yea, hook up vmgen to poop out the bytecode into a file
09:07:49FromDiscord<sealmove> and remind me what's wrong with `nim secret` 😅 looks fine
09:08:45FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "and remind me what's": ffi
09:08:54FromDiscord<Yardanico> and other limitations that apply to nimscript
09:10:11FromDiscord<haxscramper> There were some issues with it for incorrect clde
09:10:20FromDiscord<haxscramper> So if you type in wrong line of code
09:10:29FromDiscord<haxscramper> It then starts to behave weirdly
09:13:26FromDiscord<sealmove> Of course a nim repl works with nimscript, not nim, personally I don't expect more
09:13:45FromDiscord<sealmove> In reply to @haxscramper "It then starts to": This should be easily fixable then
09:16:10FromDiscord<Rika> How so
09:17:52FromDiscord<sealmove> It just needs polishing
09:18:04FromDiscord<haxscramper> Well, if I run VM manually it works better
09:18:09FromDiscord<Elegantbeef> Get the turd polish out!
09:18:31FromDiscord<Elegantbeef> yea joke aside you probably can do it better just using the VM directly
09:18:48FromDiscord<Elegantbeef> Destroying interpreter inbetween runs
09:19:08FromDiscord<haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test6.nim
09:19:14FromDiscord<sealmove> and what about set variables?
09:19:38FromDiscord<Elegantbeef> This is where i say to use nimscripter 😛
09:21:04*kenran joined #nim
09:21:35FromDiscord<Elegantbeef> Dont know if my string operations would make a good repl back bone, probably would get annoying fast
09:23:20FromDiscord<sealmove> github has halloween theme :D
09:25:13FromDiscord<haxscramper> automatically applied to all c++ projects
09:25:14FromDiscord<haxscramper> very scary
09:26:17FromDiscord<sealmove> xD
09:26:33FromDiscord<sealmove> The contribution panel is orange
09:29:06kenranIf there's a `func foo(): string = ...` that basically only does a for loop mutating a string var, but then I forget to return the string, then IIUC the empty string is returned (as it's the default string). Can I somehow "make this into an error"?
09:29:58FromDiscord<Elegantbeef> use the result?
09:30:34kenranI use the result (it's show in the output, but the empty string just works there, too, ofc)
09:31:10FromDiscord<Rika> You can’t make it an error
09:31:12kenranMaybe it's just because it's a string, thinking about it I'd hope that I wouldn't have the same "problem" with custom types. Let me check
09:31:18FromDiscord<Elegantbeef> You can
09:31:18FromDiscord<Rika> Not without a check at the end
09:31:22FromDiscord<Rika> I mean
09:31:26FromDiscord<Yardanico> In reply to @kenran "If there's a `func": there were some discussions about that before too, but no, AFAIK there's no warning/error currently that will trigger if you haven't used `result` in a proc
09:32:02FromDiscord<Rika> If you want it to be an error then use either end of expression returning or explicit returns
09:32:16FromDiscord<sealmove> when should it be triggered though? it sounds a little vague
09:32:19kenran@Elegantbeef Oh, I totally forgot about Nim's `result` and thought you meant something else. Now it's come back to me :)
09:32:37FromDiscord<Yardanico> ah i misunderstood kenran
09:33:07FromDiscord<Rika> I don’t know what I don’t understand
09:34:05FromDiscord<sealmove> maybe it could be a warning/error if the result variable is not used and there is no explicit `return`
09:34:32FromDiscord<Rika> No, some people intentionally do not use result in some branches of their code
09:34:40kenranI just forgot about `result` existing at all, and was wondering why my func still returned anything, thinking it would take the "default string value".
09:34:45FromDiscord<Rika> And that would need control flow analysis would it?
09:35:18FromDiscord<Elegantbeef> Not strictly speaking
09:35:25kenranWhat I learned (again) is that in my func I actually *should* use result, as then the problem can't even appear. Right now I'm initializing `var s = ""` and mutate that
09:35:27FromDiscord<Elegantbeef> You can do it easily with just `return` and `result` checks
09:35:57FromDiscord<Rika> Would that not give false positives
09:35:57kenranThanks everyone!
09:36:05FromDiscord<Elegantbeef> It would
09:36:18FromDiscord<Rika> Would or would not
09:36:23FromDiscord<Rika> Fuck English
09:36:28FromDiscord<Elegantbeef> It would
09:36:33FromDiscord<Rika> Okay
09:36:35FromDiscord<Elegantbeef> for instance a proc inside a proc
09:36:40FromDiscord<Rika> Yes
09:38:09kenranNim is something else entirely. Even though it looks pretty simple on the surface to me, it's just a whole other world from what I'm usually doing (mostly Haskell, sometimes Clojure and F#). But I've missed it! Especially the compile times!
09:39:14FromDiscord<Elegantbeef> Can get pretty fancy quickly with a macro for this rika https://play.nim-lang.org/#ix=3Ds5
09:41:36FromDiscord<Rika> Result behind an if statement with no accompanying else or anything after?
09:42:08FromDiscord<Elegantbeef> Hhmm?
09:42:31FromDiscord<Rika> When the if is fulfilled result is used, otherwise it is not
09:42:46FromDiscord<Elegantbeef> I mean that requires flow like i said
09:42:51FromDiscord<Rika> Same issue with for loops I guess, if the for loop is never entered then you have no set result
09:42:55FromDiscord<Rika> Yes I know
09:42:58FromDiscord<Rika> That’s what I meant
09:43:08FromDiscord<Rika> Of course you can just see if you used result or not in a body
09:43:14FromDiscord<Rika> That’s literally just grep
09:43:35FromDiscord<Rika> You would be pretty crazy to have to write a macro for just that
09:44:37FromDiscord<Elegantbeef> I mean you could have a `{.ensureResult.}` which you apply to all your procs to ensure you actually touch result be it through return(implict/explict), or directly
09:44:49FromDiscord<Elegantbeef> You dont always want to set result
09:45:18FromDiscord<Elegantbeef> But it'd not be too difficult to mark branches where you dont touch the result and release a warning
09:45:50FromDiscord<Elegantbeef> Applying the logic i already showed would work for branches you'd just need to take that consideration into account
09:46:02FromDiscord<Elegantbeef> But anyway my stupidity aside, i sleep
09:47:56FromDiscord<Rika> Okay, it makes sense as a building block
09:55:32FromDiscord<sealmove> Where are we at 'Go to Definition'? (Sorry for the stupid questions, I haven't touched Nim for a while)
09:56:59FromDiscord<haxscramper> technically supported, in reality nimsuggest is ...
09:57:07FromDiscord<haxscramper> well, it works techically
09:57:08FromDiscord<haxscramper> sometimes
09:57:17FromDiscord<haxscramper> at least I've seen someone do it once
09:57:40FromDiscord<sealmove> with a vscode plugin?
09:57:48FromDiscord<haxscramper> yes
10:25:44FromDiscord<shirleyquirk> does anyone know a way to get the path to a module's .nim file, from the modulename?
10:26:31FromDiscord<haxscramper> From module name alone?
10:26:54FromDiscord<haxscramper> There are hacks, but no concrete way IIRC
10:27:00FromDiscord<shirleyquirk> i can only think of getting searchPaths from std/compilesettings and walking them, but surely the compiler knows, somewhere
10:27:35FromDiscord<haxscramper> You can try to get path from module symbol in that case
10:28:03FromDiscord<haxscramper> Pass module name to a typed macro, then maybe get lineInfoObj or something
10:28:13FromDiscord<shirleyquirk> lineInfo! great shout
10:28:20FromDiscord<haxscramper> Otherwise compiler setting is the only way
10:29:22*kenran quit (Ping timeout: 260 seconds)
10:30:19*kenran joined #nim
10:33:37*kenran quit (Client Quit)
10:41:19FromDiscord<evoalg> Is "for i, x in e: e[i] = 2 x - 1" considered dangerous as I'm changing the thing I'm looping over? My first reaction is that it's a dangerous, but I'm thinking it might be actually ok? I'm thinking that "apply" and "applyIt" might be doing it that way anyway?
10:43:44FromDiscord<haxscramper> define "dangerous"
10:44:03FromDiscord<haxscramper> I would assume it is not dangerous
10:44:05FromDiscord<haxscramper> I mean
10:44:08FromDiscord<haxscramper> `a = a + 1`
10:44:11FromDiscord<haxscramper> basically
10:44:19FromDiscord<haxscramper> just `a` is taken and put into array
10:44:47FromDiscord<evoalg> ok if you put it that way, it seems perfectly fine - thank you!
10:46:20FromDiscord<shirleyquirk> what would be dangerous would be mutating e while iterating over it, but `for x in e.mitems: x = 2x-1` is fine
10:47:16FromDiscord<haxscramper> it is not "dangerous" - `e.add` or `e.pop` is disallowed and lead to explicit exception
10:47:22FromDiscord<haxscramper> in the loop body
10:47:42FromDiscord<haxscramper> and yes, `for x in mitems(e): x = 2 x - 1` is probably even better than indexing, because that's what `mitems` is for anywya
10:49:34FromDiscord<shirleyquirk> made safe by the language. best kind of safe.
10:50:03FromDiscord<evoalg> oooo I didn't know about mitems ... nice
10:54:24FromDiscord<sealmove> hmm the intellij plugin works great
10:54:38FromDiscord<Yardanico> except when you want autocompletion :P
10:55:12FromDiscord<Yardanico> also seems like the author haven't got back to its development (he said he'll continue in september), guess he's busy
10:57:51FromDiscord<sealmove> hmm it shows an error "can't find nim executable" or something, but everything works fine
11:15:43*krux02 joined #nim
11:35:24*Vladar joined #nim
11:54:10FromDiscord<Schelz> How to get a specific value from a tuple or a list ?
11:54:28FromDiscord<Schelz> like ex in python: tuple = (1, 4, 5)
11:54:36FromDiscord<Schelz> tuple[0]
11:54:56krux02you should be able to index the tuple, but only with a constant index
11:55:01FromDiscord<haxscramper> `let a = (1, 4, 5)`
11:55:06FromDiscord<haxscramper> `a[0]`
11:55:16FromDiscord<haxscramper> note that nim tuples and lists are different
11:55:32FromDiscord<Schelz> a ok thx
11:55:42FromDiscord<haxscramper> tuple's types and size are fixed at compile-time
11:55:51krux02Schelz, better said python tuples an nim tuples are different
11:55:57FromDiscord<haxscramper> and list (`seq`) can only hold one type
11:56:43FromDiscord<Schelz> i know the difference between tuple and list but the method to get a value from them is the same in python
11:57:32FromDiscord<Schelz> and that was the misunderstanding in nim
12:02:09krux02tuples in Nim are basically just to return multiple values from a function
12:02:29krux02I couldn't find another good usage for them yet.
12:02:45FromDiscord<Rika> Temporary objects that don’t deserve a real type yet
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:32*supakeen joined #nim
12:36:14FromDiscord<evoalg> I managed to so something with what I believe is bad practice: https://play.nim-lang.org/#ix=3Dtr ... but I don't know enough to get it to work with good practice - how would I do that?↵I'm trying to use "newSeqWith" to get a sequence initialized with an incrementing int value, eg: @[1, 2, 3, 4, 5]
12:36:44FromDiscord<Rika> Use a closure iterator instead I guess
12:37:00FromDiscord<Rika> Can’t demonstrate right now, I’m not at a computer
12:37:52FromDiscord<evoalg> ok thanks ... over my head so I think I'd need an example ideally, but that gives me something to investigate!
12:37:54FromDiscord<Recruit_main707> id pass i as an argument, and then its not that bad i guess
12:38:14FromDiscord<Recruit_main707> nvm
12:38:22FromDiscord<evoalg> I couldn't get that to work
12:41:07FromDiscord<Rika> How about using collect?
12:42:03FromDiscord<evoalg> you're right, I should just use collect, so simple!
12:57:19FromDiscord<evoalg> Oh just for fun I modified a closure iterator and got it to work (but I will use collect instead, that closure iterator is weird!)
13:05:13*rockcavera joined #nim
13:05:13*rockcavera quit (Changing host)
13:05:13*rockcavera joined #nim
13:26:09FromDiscord<dom96> 1.85 million QPS 🔥
13:35:10FromDiscord<willyboar> In reply to @dom96 "1.85 million QPS 🔥": where?
13:36:00FromDiscord<Yardanico> i guess dom is talking about httpbeast
13:37:07FromDiscord<willyboar> I know but where that happened? techempower?
13:38:20FromDiscord<Yardanico> in his tests
13:39:36FromDiscord<dom96> https://github.com/dom96/httpbeast/pull/65
13:41:24FromDiscord<dom96> In techempower httpbeast is at 5.8 million, but they've got completely different hardware of course
13:41:53FromDiscord<Yardanico> what command were you testing with btw?
13:41:59FromDiscord<Yardanico> and what file
13:42:02FromDiscord<Yardanico> helloworld.nim ?
13:42:06FromDiscord<dom96> benchmark.nim
13:42:13FromDiscord<Yardanico> ah
13:42:34FromDiscord<dom96> with --gc:markandsweep as well which improves performance a lot
13:42:59FromDiscord<tandy> if you take a `seq1` as proc parameter, does `var x = seq1` copy the values or reference?
13:44:08FromDiscord<Yardanico> it depends :P
13:44:28FromDiscord<SC> is orc works with the Nim web frameworks (e.g, Jester?)
13:44:33FromDiscord<Yardanico> orc generally does, yes
13:45:10FromDiscord<dom96> yep, it should be compatible with everything
13:46:01FromDiscord<SC> Ok thank you.
13:46:41FromDiscord<dom96> orc QPS: 1.5 million, default gc: 1.6 million and m&s: 1.85 million
13:48:16FromDiscord<Rika> what about boehm? or is that unsupported
13:48:26FromDiscord<SC> wow. I guess m&s is a stop the world gc. but still quite a result!
13:48:35FromDiscord<Rika> it is not
13:48:47FromDiscord<SC> m&s is not the stop the world gc? really?
13:48:50FromDiscord<SC> oh...
13:49:18FromDiscord<dom96> hm, boehm crashes.
13:49:34FromDiscord<dom96> I just get a segfault during startup
13:49:51FromDiscord<Rika> In reply to @SC "m&s is not the": well i know it is one but apparently the nim docs say it is not
13:49:59FromDiscord<Rika> might be to do with the implementation in nim
13:50:18FromDiscord<dom96> if it was stop the world then I would expect it to do far worse
13:50:29FromDiscord<SC> oh... sounds interesting...
13:50:49FromDiscord<Rika> In reply to @dom96 "if it was stop": thats okay i was just asking out of interest
13:50:56FromDiscord<Rika> boehm is stop the world so i assume it would be slower
13:52:48FromDiscord<Yardanico> @dom96 and what wrk command were you testing the benchmark with?
13:52:56FromDiscord<Yardanico> i just want to play around with it a bit too
13:53:11FromDiscord<dom96> I'm using the techempower commands, so you need to have a look at how they do it
13:55:23FromDiscord<Yardanico> the benchmark.nim is a bit wrong though, techempower fixed it - https://github.com/TechEmpower/FrameworkBenchmarks/commit/e2838399f590c656310133311cf12027684d1792#diff-e08d8fe907c238b949215cf77996d97c264a1c492e9978507a216e532b039332
13:55:31FromDiscord<Yardanico> it can't be "const" because it measures json serialization time as well
13:55:56FromDiscord<Yardanico> but for purely httpbeast benchmarks it's fine
13:56:30FromDiscord<Yardanico> https://github.com/TechEmpower/FrameworkBenchmarks/issues/4794
13:57:46FromDiscord<dom96> sure
13:57:51FromDiscord<dom96> I'm testing plaintext anyway
14:09:46*arkurious joined #nim
14:37:06FromDiscord<dom96> huh, turns out SO_REUSEPORT is not supported on WSL
14:42:02FromDiscord<dom96> So I've been benchmarking on a single thread this whole time lol
14:51:43*vicecea quit (Remote host closed the connection)
14:52:21*neurocyte0132889 joined #nim
14:52:21*neurocyte0132889 quit (Changing host)
14:52:21*neurocyte0132889 joined #nim
14:53:34*vicecea joined #nim
15:05:30FromDiscord<dom96> half tempted to grab a Ubuntu live usb and run it on my desktop, see what Ryzen is capable of
15:45:50*PMunch joined #nim
15:49:41*xet7 quit (Remote host closed the connection)
15:50:42*xet7 joined #nim
16:06:45*PMunch quit (Quit: leaving)
16:35:30FromDiscord<ajusa> In reply to @Yardanico "the benchmark.nim is a": I wonder if a different JSON library would be faster/allowed
16:47:37FromDiscord<dom96> definitely would be 🙂
17:02:32FromDiscord<Bung> plaintext is good target
18:56:17*vicecea quit (Remote host closed the connection)
18:56:49*vicecea joined #nim
19:08:43*vicecea quit (Remote host closed the connection)
19:09:13*vicecea joined #nim
19:18:04*beeswax joined #nim
19:18:32beeswaxis there an easy way to write floats in binary format to stdout for piping into paplay?
19:20:52FromDiscord<Elegantbeef> `stdout.writeBuffer(yourFloat.addr, sizeof(yourFloat)`
19:21:12beeswaxthank you!
19:25:36Amun-Ramind it depends on endianness
19:25:44Amun-Rait (the result)
19:27:51FromDiscord<Elegantbeef> Sure but given both programs are running locally
19:28:36FromDiscord<Elegantbeef> I guess unless one is written with a VM'd language or expects a different endianess it can be an issue
19:42:43*beeswax quit (Quit: leaving)
19:57:51*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
20:02:24*neurocyte0132889 joined #nim
20:02:24*neurocyte0132889 quit (Changing host)
20:02:24*neurocyte0132889 joined #nim
21:39:33*Vladar quit (Quit: Leaving)
23:32:15FromDiscord<Elegantbeef> @impbox [ftsf]\: hopefully you dont mind that i threw this quick example in TMWN to showcase nimscripter 1.0 😀
23:32:16FromDiscord<Elegantbeef> https://www.jasonbeetham.com/snake/nicoscripter.html
23:32:49FromDiscord<impbox [ftsf]> not at all
23:33:00FromDiscord<impbox [ftsf]> just need a prettier text editor
23:33:16*oprypin_ quit (Quit: Bye)
23:33:26*oprypin joined #nim
23:33:34FromDiscord<Elegantbeef> Indeed and a instant pause, but yea it's just an example showing it working with wasm
23:34:42FromDiscord<Elegantbeef> Oh the mouse pause works now, odd guess i tested the wrong code earlier
23:44:42FromDiscord<huantian> Is it possible to have nimsuggest via the nim vscode plugin always give me autosuggest in snake_case or camelCase only?
23:44:52FromDiscord<huantian> or do I just have to deal with it
23:45:18FromDiscord<Elegantbeef> I did look at adding the functionality and it very much seems like it might be possible but will slow down the suggestions
23:45:49FromDiscord<Elegantbeef> There also was a big issue with screamy constants
23:46:15FromDiscord<huantian> yeah I can see how that would be problem
23:50:01FromDiscord<huantian> It is a tad annoying when two libraries have different styles
23:51:13FromDiscord<Elegantbeef> Yea it's all these people using snakecase like animals
23:53:29FromDiscord<Benjamin> Wouldn't it just be a simple postprocessing step?
23:55:28FromDiscord<Elegantbeef> It is mostly
23:55:58FromDiscord<Elegantbeef> Add a flag for "prefer X styling" and then convert all the suggestions to the case you want before outputting
23:56:32FromDiscord<Elegantbeef> I do think i have the code still if anyone wants to finish it and make a PR
23:57:56FromDiscord<Elegantbeef> vscode.diff https://media.discordapp.net/attachments/371759389889003532/904519591374512218/vscode.diff
23:58:07FromDiscord<Elegantbeef> on saem's Vscode extension