<< 14-12-2022 >>

00:01:14FromDiscord<a weird programmer> is it possible to implement my own system that enforces this? or would i have to edit how the compile works?
00:01:25FromDiscord<a weird programmer> (edit) "compile" => "compiler"
00:03:16FromDiscord<Elegantbeef> The compiler has no mechanism for this
00:03:33FromDiscord<Elegantbeef> Almost all Nim code doesnt even use type annotations
00:04:02FromDiscord<a weird programmer> so if i would go about enforcing this what would my options be?
00:05:46FromDiscord<Elegantbeef> Fork the compiler
00:10:19FromDiscord<huantian> or make a style checker and/or linter
00:10:34FromDiscord<huantian> and make users of your project use it and/or integrate it with your CI
00:10:54FromDiscord<huantian> (edit) "users" => "contributers"
00:14:51*moonlit quit (Remote host closed the connection)
00:15:13*moonlit joined #nim
00:24:52FromDiscord<Yepoleb> fucking kernel headers are so cursed
00:24:58FromDiscord<Yepoleb> `u8 addr[][ETH_ALEN]` i hate this
00:25:29FromDiscord<<She>Horizon</Her>> sent a code paste, see https://play.nim-lang.org/#ix=4iy9
00:26:03FromDiscord<a weird programmer> In reply to @Elegantbeef "Fork the compiler": can you point me to what file dictates how vars work?
00:26:22FromDiscord<Yepoleb> apparently it's syntax to for an array of undetermined size of arrays of ETH\_LEN uint8's
00:26:55FromDiscord<Elegantbeef> look for semVarStmt or similar↵(@a weird programmer)
00:27:31FromDiscord<a weird programmer> In reply to @Elegantbeef "look for semVarStmt or": is this the file name?
00:27:54FromDiscord<Elegantbeef> No
00:28:19FromDiscord<Elegantbeef> You also will need to ensure that the code you're erroring on isnt in the stdlib or a pkg
00:28:28FromDiscord<Elegantbeef> It's quite a undertaking for no benefit really
00:29:03FromDiscord<a weird programmer> yeah
00:37:18FromDiscord<Rika> the linter would be easier
00:54:32*pbsds quit (Quit: The Lounge - https://thelounge.chat)
00:55:32*pbsds joined #nim
01:07:59*pbsds quit (Quit: The Lounge - https://thelounge.chat)
01:10:32*pbsds joined #nim
01:36:11FromDiscord<huantian> and along the way you could make a good nim linter too!
01:42:58FromDiscord<<She>Horizon</Her>> So NEPs would become a thing? Lmao
01:43:06FromDiscord<<She>Horizon</Her>> Nim extension proposals
01:46:52FromDiscord<Elegantbeef> I still say we just need TRMs to work and we get a first class linter
01:57:53FromDiscord<<She>Horizon</Her>> TRMs?
01:58:11FromDiscord<Elegantbeef> Term rewriting macros
01:58:11FromDiscord<<She>Horizon</Her>> Treesitter something?
01:58:13FromDiscord<Elegantbeef> Pattern matching dispatch macros
01:58:19FromDiscord<<She>Horizon</Her>> Ah
02:00:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iyk
02:00:24FromDiscord<Elegantbeef> In theory should error on `b` but TRMs dont work like you'd expect
02:23:53FromDiscord<ringabout> It seems that nimble is completely broken with the devel branch. https://github.com/nim-lang/nimble/pull/1041
02:43:09NimEventerNew thread by Ward: TinyRE - Tiny Regex Engine for Nim, see https://forum.nim-lang.org/t/9723
02:54:15FromDiscord<@thatrandomperson5-6310e3b26da03> Is it possible to get the type of this `let hello = makeHelloString()` in a macro, or do i have to explicitly type
03:07:21FromDiscord<! Nilts> In reply to @@thatrandomperson5-6310e3b26da03 "Is it possible to": If anyone has the answer please ping me because i am not going to be online
03:07:36FromDiscord<! Nilts> (edit) "me" => "my discord account"
03:36:56NimEventerNew Nimble package! tinyre - Tiny Regex Engine for Nim, see https://github.com/khchen/tinyre
03:46:35*arkurious quit (Quit: Leaving)
04:32:27FromDiscord<ringabout> When does `template nodeInfo: var NodeInfo = nodesInfo[node]` change its meaning?
04:32:57FromDiscord<ringabout> Perhaps the alias templates PR
04:35:07FromDiscord<sexnine> might be a dumb question and maybe library specific but to compile this nim app (using dimscord lib) i need to build with the flag `-d:ssl` and that works when using `nimble build -d:ssl` but not when using `nimble run -d:ssl`, i dont really feel like building every time and then running the executable, `nimble run` is just easier, is there anything i can do?
04:35:17FromDiscord<sexnine> (edit) "compile" => "run"
04:35:27FromDiscord<Elegantbeef> make a `config.nims` with `--define:ssl`
04:36:23FromDiscord<ringabout> In reply to @ringabout "When does `template nodeInfo:": The templates seems to evaluate its result which doesn't happen in 1.6.10
04:36:40FromDiscord<ringabout> (edit) "which doesn't happen in 1.6.10" => "wrong;y"
04:36:49FromDiscord<ringabout> (edit) "templates" => "template" | "wrong;y" => "wrongly"
04:37:51FromDiscord<sexnine> In reply to @Elegantbeef "make a `config.nims` with": thank you, helped :thanks:
04:43:00NimEventerNew Nimble package! fitl - Self-contained fit of linear models with regression diagnostics, see https://github.com/c-blake/fitl
04:48:12*Jjp137 joined #nim
05:03:02FromDiscord<sexnine> hows nimsuggest v2 compared to v3? is v3 stable and should it be used over v2?
05:45:24FromDiscord<MetuMortis> I'd like to see a tutorial about how to create a nim dev env
05:46:49FromDiscord<MetuMortis> VSCode Extension is good but I couldn't create a dev env in Intellij, Neovim or Doom Emacs
06:11:11FromDiscord<ShalokShalom> In reply to @MetuMortis "VSCode Extension is good": what stopped you in Intellij?
06:12:00FromDiscord<ShalokShalom> You know this? https://github.com/alaviss/nim.nvim
06:22:31FromDiscord<Bung> undefined
06:25:18*ltriant quit (Ping timeout: 252 seconds)
06:38:44FromDiscord<Freakwill (William Song)> sent a code paste, see https://paste.rs/OtE
06:41:51FromDiscord<Elegantbeef> Mean is overloaded so passing it as a pointer proc that is generic doesnt give it any information
06:50:55*tiorock joined #nim
06:50:55*tiorock quit (Changing host)
06:50:55*tiorock joined #nim
06:50:55*rockcavera is now known as Guest9757
06:50:55*Guest9757 quit (Killed (cadmium.libera.chat (Nickname regained by services)))
06:50:55*tiorock is now known as rockcavera
07:01:17FromDiscord<ynfle> In reply to @@thatrandomperson5-6310e3b26da03 "Is it possible to": @! Nilts What do you mean by "get the type of this in a macro"? What is the macro operating on? If that line is passed in, the macro input param can be `typed`
07:07:51*kenran joined #nim
07:09:07*kenran quit (Remote host closed the connection)
07:22:15FromDiscord<Freakwill (William Song)> thank you.
07:34:40*PMunch joined #nim
07:58:14*rockcavera quit (Remote host closed the connection)
08:13:02FromDiscord<luteva> In reply to @a weird programmer "so if i would": as huntian and beef said: build your own "checker" and throw an error on what you would like to ban. you can then of course use the nim compiler to do the rest. but of yourse you can't use existing code anymore as most of it doesn't have the types annotated.
08:13:33*junaid_ joined #nim
08:15:11FromDiscord<Phil> Couldn't you ensure that the checker only checks project-code?↵I mean, in order to gather a list of all files to be checked, gather all nim files referenced in import statements, then all nim files reference in import statements from the second wave of nim files and so on, then throw out everything from within .nimble and analyze the rest.↵Or am I missing something?
08:15:28FromDiscord<Phil> (edit) "statements," => "statements of the original file you pass to the checker,"
08:15:33*ltriant joined #nim
08:15:45FromDiscord<Phil> (edit) "Couldn't you ensure that the checker only checks project-code?↵I mean, in order to gather a list of all files to be checked, gather all nim files referenced in import statements of the original file you pass to the checker, then all nim files reference in import statements from the second wave of nim files and so on, then throw out everything from within ... .nimbledirectory" added "the" | "the.nimble ... and" added "direct
08:16:58FromDiscord<Elegantbeef> Matrix is always fun
08:17:00FromDiscord<Elegantbeef> Yes you could
08:17:15FromDiscord<Elegantbeef> I still just say TRM is the true path towards user defined linters
08:21:13FromDiscord<luteva> @ElegantBeef i wanted to use your constructor/defaults lib and i just tried the examle. But it doesn't work (at least for nim version 1.6.6)↵Here's the message:↵https://discord.com/channels/371759389889003530/371759389889003532/1052230992628289666↵Yo you have any idea how to solve this?
08:22:18*junaid_ quit (Remote host closed the connection)
08:22:33FromDiscord<Elegantbeef> yea i guess not use funcs in my code 😄
08:27:34FromDiscord<Elegantbeef> 1.0.6 is out
08:27:53FromDiscord<Elegantbeef> If you do run into any issues please do make an issue on the repo
08:28:13FromDiscord<Elegantbeef> It's much better than asking a question into the void 😛
08:29:34FromDiscord<Elegantbeef> For some reason the compiler thinks `&` has a side effect with `strictFuncs` on 1.6.x
08:35:18FromDiscord<Phil> In reply to @Elegantbeef "I still just say": TRM? Not aware of the acronym
08:35:41FromDiscord<Elegantbeef> Term rewriting macros
08:35:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4izd
08:37:46FromDiscord<Elegantbeef> They use patterns to call macros
08:55:29FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1052509121729003550/image.png
08:55:51FromDiscord<albassort> when will the war crime tribunal see me?
08:56:14FromDiscord<albassort> eh fuck it I think I'll just do it line by line
08:56:32FromDiscord<<She>Horizon</Her>> ....@albassort
08:56:35FromDiscord<<She>Horizon</Her>> What the fuck-
08:56:53FromDiscord<albassort> sometimes you need to work low level with the keyboard and want broad support
08:56:55*ltriant_ joined #nim
08:57:12FromDiscord<<She>Horizon</Her>> Is there no existing library for that?
08:57:18FromDiscord<albassort> gotta break out keysymdef.h
08:57:19FromDiscord<<She>Horizon</Her>> Also either way: What the fuck-
08:57:20*ltriant quit (Ping timeout: 272 seconds)
08:57:27FromDiscord<albassort> make x11 has it
08:57:27FromDiscord<<She>Horizon</Her>> In reply to @albassort "gotta break out keysymdef.h": F
08:58:14FromDiscord<albassort> https://github.com/nim-lang/x11/blob/2093a4c01360cbb5dd33ab79fd4056e148b53ca1/x11/keysym.nim
08:58:16FromDiscord<albassort> they have this
08:58:19FromDiscord<albassort> but i dont think its my usecase
08:58:55FromDiscord<albassort> i want a big fat enum
09:01:59FromDiscord<albassort> oh god i changed too many things at once everything is broken
09:34:37*eal left #nim (ERC 5.4.1 (IRC client for GNU Emacs 28.2))
09:36:07FromDiscord<luteva> sent a code paste, see https://paste.rs/jyI
09:57:49FromDiscord<a weird programmer> In reply to @Isofruit "Couldn't you ensure that": thats what i though
09:58:03FromDiscord<a weird programmer> make it ignore imports and only go through files in the dir
09:58:16FromDiscord<a weird programmer> sounds like one hell of a project to me
10:05:25FromDiscord<Elegantbeef> @luteva\: that's to be expected, if you want other behaviour use `constr`'s macro instead
10:17:28*pro joined #nim
10:17:57*pro quit (Client Quit)
10:22:43FromDiscord<luteva> ok. hmmm i do not really uderstand the benefit of constr (in this case). i mean: if i have to write the proc setting the default values the benefit of having the defaults in the type declaration is lost. And a standard initX / newX proc may also set the default values. So i do not see the benefit of the constr macro.
10:23:18FromDiscord<luteva> but maybe i am just stupid 😜
10:24:12FromDiscord<Elegantbeef> Yea it probably doesnt work in this case
10:25:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4izK
10:25:47FromDiscord<Elegantbeef> Or the equivalent that works
10:26:05FromDiscord<Elegantbeef> Constructing OOP is quite a chore
10:26:18FromDiscord<Elegantbeef> Cause you really need a `proc init(myBase: var Base)`
10:29:40FromDiscord<Elegantbeef> The simple thing is that `defaults` does not work with anything complex, cause it cannot
10:30:52FromDiscord<Elegantbeef> I guess i could make `implDefaults` more complex to generate calls to the parent types
10:41:28*FromDiscord quit (Remote host closed the connection)
10:41:41*FromDiscord joined #nim
11:22:26deadmarshalHow can i prepend something to a sequence?
11:38:34FromDiscord<luteva> In reply to @Elegantbeef "I guess i could": that would be really great! 😃
12:10:30*cyraxjoe quit (Ping timeout: 260 seconds)
12:10:43*cyraxjoe joined #nim
12:12:52FromDiscord<Phil> In reply to @deadmarshal "How can i prepend": std/sequtils has an `insert` proc
12:14:35deadmarshalPhil:awesome
12:49:27*pro joined #nim
12:50:55FromDiscord<<She>Horizon</Her>> Anyway to stop a certain object from being managed by the GC in Nim?
12:51:35PMunchDon't make it a ref object?
12:51:54PMunchOther than that you can of course GC_ref it manually to make sure the refcount is always >0
12:52:14*pro left #nim (#nim)
12:52:35FromDiscord<<She>Horizon</Her>> Think i found it
12:52:48FromDiscord<<She>Horizon</Her>> In reply to @PMunch "Don't make it a": I'm using the Minetypes object
12:52:52FromDiscord<<She>Horizon</Her>> So
12:55:25PMunchMinetypes?
12:56:31FromDiscord<<She>Horizon</Her>> Yup
12:56:33FromDiscord<<She>Horizon</Her>> MimeDB
12:56:41FromDiscord<<She>Horizon</Her>> And I'm using it with prologue
12:57:03FromDiscord<<She>Horizon</Her>> So it has to be threadsafe, it works fine now but just in case, plus the warning is annoying so might as well solve it
13:06:25FromDiscord<albassort> @treeform oi you forgot about the HEAD verb and it through an error because no body
13:06:39FromDiscord<albassort> (edit) "through" => "throws "
13:06:43FromDiscord<albassort> (edit) removed ""
13:07:42FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iAa
13:08:12FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4iAa" => "https://play.nim-lang.org/#ix=4iAb"
13:08:40FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=
13:10:30FromDiscord<albassort> :notLikeThis:
13:15:20PMunchHmm, is there a compile-time version of the `line` pragma?
13:16:21FromDiscord<Phil> In reply to @PMunch "Don't make it a": Wouldn't making the object a global object make it non-gcable since its in global scope which only dies when the program does?
13:17:26PMunchBasically I have a macro which reads some files and generates Nim code. Now if there's something wrong in one of the files it will generate incorrect code and trigger a compilation error. But the error trace just points to what in my code generates the code, I tried to use `{.line: .}` to pass it information about which file I read for generation, but this doesn't seem to do anything on compile-time..
13:17:40PMunch@Phil, sure, that should work as well
13:20:09FromDiscord<Phil> In reply to @Event Horizon "And I'm using it": Given that Pmunch just confirmed, would putting the variable into global scope you don't want to have GC'ed work?
13:21:07PMunchDamn it.. I can get the LineInfo of a NimNode, and I can copy it from one NimNode to another. But I can't seem to just set it..
13:23:23FromDiscord<<She>Horizon</Her>> In reply to @Isofruit "Given that Pmunch just": Already did, but it's still giving that warning even if it impacts nothing
13:24:22FromDiscord<Phil> In reply to @Event Horizon "Already did, but it's": Hmmmmmm I could've sword there was a pragma that allows you do enable/disable GC for sections of code
13:24:29FromDiscord<Phil> sworn, not sword
13:24:32FromDiscord<Phil> I don't have a sword
13:30:47FromDiscord<Phil> Skimming through the pragmas section of the nim manual: I stand corrected
13:30:51FromDiscord<Phil> (edit) "corrected" => "corrected, can't find one"
13:35:06FromDiscord<luteva> do you mean GC_ref and GC_unref ?
13:40:09FromDiscord<Phil> Just looked at it, that's a proc? Could've sword it was a pragma.... but yeah I guess so
13:41:40FromDiscord<Rika> it doesnt really make sense as a pragma
13:43:39FromDiscord<ringabout> There is a pragma disabling the gcsafe analysis.
13:45:39FromDiscord<Phil> Maybe I've disabled gcsafe analysis so much I just think everything related to garbage collection is a pragma
13:49:06FromDiscord<albassort> is there a function which formats a number with space
13:49:18FromDiscord<albassort> "eg" " 1" " 2"
13:52:42FromDiscord<albassort> leading 0s good enough
13:53:32PMunchhttps://nim-lang.org/docs/strutils.html#align%2Cstring%2CNatural%2Cchar
13:53:55PMunch@albassort ^
13:55:47PMunchHmm, is there a way to override `$` with a macro in a scope?
14:14:19FromDiscord<! Nilts> In reply to @ynfle "<@910899642236043294> What do you": Like thats part of a nodetree that i got
14:15:03FromDiscord<Phil> In reply to @PMunch "Hmm, is there a": Can't say I succeeded, I ran into similar issues and tried for a while with having `$` methods, but that blew up in my face in its own way and I left saddened and disheartened
14:16:32*xaltsc_ is now known as xaltsc
14:17:19*pro joined #nim
14:17:28*pro left #nim (#nim)
14:22:08FromDiscord<Phil> In reply to @albassort "is there a function": Did you already browse through strformat?
14:22:28FromDiscord<Phil> https://nim-lang.org/docs/strformat.html#standard-format-specifiers-for-strings-integers-and-floats↵Sounds like what you need
14:29:34*rockcavera joined #nim
14:37:08PMunch@Phil, well I wanted to use a macro that was local to a procedure to transform all $ calls in that procedure only
14:50:28om3gaError Success to you all friends! (Microsoft style greeting). I removed libsndfile from my project, raw C code integration is not easy, so I will try now nim-riff for reading wav's. Strange thing, but This is good example why I hate dynamic libraries
14:50:37FromDiscord<Yepoleb> PMunch\: can't you just replace all calls of $ with some other name instead of trying to replace the definition of $?
14:52:06FromDiscord<Rika> In reply to @om3ga "Error Success to you": congratulations on successfully failing
14:52:53PMunch@Yepoleb, well replacing calls is considered bad practice. Causes issues with templates and composeability of macros
14:54:33FromDiscord<Yepoleb> Is this supposed to work for code you don't control?
14:54:51PMunchYes
14:56:01FromDiscord<Yepoleb> I don't understand why it would cause issues
14:56:17FromDiscord<Yepoleb> Your macro has to run after all others anyway
14:56:43PMunchEssentially the system I'm building reads a folder structure of template files, then matches that to objects in Nim and generates a procedure to convert an object into the template representation
14:58:52PMunch@Yepoleb, well you end up with errors like this: https://github.com/dom96/jester/issues/114
15:00:34PMunchI've actually considered writing a guide to macros that would amongst other things go into this. It's easy to write macros in Nim that don't really work that well
15:04:59*PMunch quit (Quit: Leaving)
15:06:53deadmarshalHow can i find the minimum element in a sequence? something like this? foldr(s,min(a,b))
15:09:01deadmarshalI also tried to get all the keys of a table with toSeq(mytable.keys) but it doesn't work. tough it works with .values
15:09:01FromDiscord<Yepoleb> PMunch\: Makes sense that macros modifying control flow cause issues with templates, but i don't see how replacing a proc name with another changes anything about that
15:09:02FromDiscord<Vindaar> In reply to @deadmarshal "How can i find": https://nim-lang.org/docs/system.html#min%2CopenArray%5BT%5D
15:11:27FromDiscord<Yepoleb> If two macros try to replace $ that is of course asking for trouble again but that's not gonna work right anyway
15:11:50deadmarshalVindaar:great
15:18:13om3gaRika, thanks. It was huge step forward.
15:19:07*Phytolizer joined #nim
15:27:21*junaid_ joined #nim
15:32:21*junaid_ quit (Remote host closed the connection)
15:39:48FromDiscord<Takemichi Hanagaki> In reply to @PMunch "I've actually considered writing": It would be awesome!
15:43:15FromDiscord<nonce> sent a code paste, see https://play.nim-lang.org/#ix=4iAS
15:46:18NimEventerNew thread by max: Nim Static linking OpenSSL issue with fork(), see https://forum.nim-lang.org/t/9724
15:47:09FromDiscord<Vindaar> In reply to @nonce "hi guys, why is": because your procedure returns a `seq[string]`, but the actual value you return, `sessionFields`, is a `Table`
15:47:30FromDiscord<nonce> argh
15:47:35FromDiscord<nonce> thank you
15:51:28*Phytolizer quit (Ping timeout: 260 seconds)
15:53:50FromDiscord<@thatrandomperson5-6310e3b26da03> How would i concatnate a string in a macro
16:22:47om3gaError: for --gc:arc|orc 'deepcopy' support has to be enabled with --deepcopy:on <--- Is this ok?
16:22:59om3gaor I did something very wrong
16:23:20om3ganever seen that error before
16:23:55FromDiscord<vindaar> depends, did you call `deepCopy` yourself? Or did you call some function that uses `deepCopy`? If it's the latter and it's a library the best idea is to open an issue about it↵(<@709044657232936960_om3ga=5b=49=52=43=5d>)
16:24:58om3gavindaar, I don't remember, I will check if deepcopy used in nim-riff
16:25:00FromDiscord<vindaar> well, if it's a runtime string in the context of the macro, then you do it same as in regular code. if you want to concat two strings that will only exist at actual runtime, you generate the call to `&` (or `add`, `fmt`, `%`, ... depending on what you want to do))
16:26:05FromDiscord<vindaar> yes, it uses it https://github.com/johnnovak/nim-riff/blob/61a7428c6136bbf7f82ca6a3148e0742044a6a8b/riff.nim#L529
16:40:50om3gavindaar, unexpected surprise
17:35:56FromDiscord<@thatrandomperson5-6310e3b26da03> Ok thanks
17:36:33FromDiscord<@thatrandomperson5-6310e3b26da03> What is the pupouse of “nnkEmpty” in macros?
17:40:32FromDiscord<vindaar> it's what the name suggests. An empty node. If you have a tree with optional fields, an empty node can be used in such places
17:43:44FromDiscord<@thatrandomperson5-6310e3b26da03> How come the `repr` only works if you stick nnkEmpty’s everywhere?
17:49:47*jmdaemon quit (Ping timeout: 265 seconds)
17:51:28*pro joined #nim
17:53:25*pro left #nim (#nim)
17:57:10FromDiscord<a weird programmer> whats the best gc mode to use
17:57:30FromDiscord<a weird programmer> and why does nim have so many gc modes as well why dont they stick with one and keep refining it
17:59:25FromDiscord<vindaar> Not sure what you mean, the only thing I can think of is if you're constructing invalid ASTs. Trying to print those breaks `repr`
18:08:19*rez joined #nim
18:13:55*moonlit quit (Remote host closed the connection)
18:14:13*moonlit joined #nim
18:19:31FromDiscord<auxym> In reply to @a weird programmer "and why does nim": swappable GCs is a feature of Nim. You can use the best GC for your application as they each have strengths and drawbacks. Atm, ORC is probably the best general-purpose choice and will be the default in nim v2 (to be release very soon, probably)
18:19:52FromDiscord<a weird programmer> In reply to @auxym "swappable GCs is a": isnt arc better?
18:25:25FromDiscord<auxym> ARC is ORC + cycle collector. If you have cycles, ARC will leak memory.
18:25:42FromDiscord<auxym> If you don't have cycles, ARC might have very slightly better performance
18:42:40NimEventerNew post on r/nim by SpookyFries: How to extract last three characters of a string?, see https://reddit.com/r/nim/comments/zlyrhw/how_to_extract_last_three_characters_of_a_string/
19:04:19*nisstyre quit (Ping timeout: 256 seconds)
19:17:55*nisstyre joined #nim
19:50:30FromDiscord<ezquerra> In reply to @auxym "ARC is ORC +": This is not phrased correctly. It’s actually the opposite: ORC is ARC + a cycle collector
19:51:17FromDiscord<ezquerra> Use arc for real-time systems for example, if you don’t have cycles or do not mind them (e.g. if you can live with the memory that won’t be collected)
19:54:20*Phytolizer joined #nim
20:05:48*Phytolizer quit (Ping timeout: 260 seconds)
20:12:54FromDiscord<aquova> sent a code paste, see https://play.nim-lang.org/#ix=4iCa
20:19:47*ltriant_ quit (Ping timeout: 260 seconds)
20:20:39*doug_ joined #nim
20:21:23doug_with following progam
20:22:05doug_const asize = 10_000_000
20:22:05doug_proc main() =
20:22:05doug_ var a: array[asize, int]
20:22:05doug_main()
20:22:48doug_get segmentation fault, but if change asize to 1_000_000 runs ok
20:23:47doug_Any thoughts?
20:26:54doug_Using Nim Compiler Version 1.6.10 [Linux: amd64]
20:28:25doug_Anyone online?
20:30:20doug_I have 32GB of main memory
20:31:30*arkurious joined #nim
20:31:30*kenran joined #nim
20:31:52*kenran quit (Remote host closed the connection)
20:32:46FromDiscord<Elegantbeef> Doug that's stack allocated so you may need to pass an argument to increase your stack size
20:34:13doug_Will try that
20:36:23FromDiscord<Elegantbeef> Should be like `--passC:"--stack,200000000"`
20:36:38FromDiscord<Elegantbeef> But the solution is still more likely to make it a `ref array[width, T]`
20:38:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iCf
20:40:18doug_nim c --passC:"--stack,20000000" testArray.nim
20:40:37doug_unrecognized command-line option ‘--stack,20000000’
20:47:18doug_If I add -d:release it runs ok for asize = 100_000_000
20:51:15doug_changing to ref array[asize, int] also works
21:21:44FromDiscord<@thatrandomperson5-6310e3b26da03> How would i iterate through the values of a the attributes type?
21:23:16FromDiscord<auxym> In reply to @ezquerra "This is not phrased": oh yeah, brain fart.
21:26:57FromDiscord<Elegantbeef> doug it might be `--passL:"-Wl,--stack, yourStackSizeHere`
21:27:06FromDiscord<Elegantbeef> Though like i said it's much smarter to just use a `ref array` and heap allocate it
21:27:12FromDiscord<Elegantbeef> No reason putting that massive object on your stack
21:31:32FromDiscord<daniellowrie (Daniel Lowrie)> Greetings All, I'm having a little trouble with my first attempt at making an HTTPs request with Nim. I've tried the example from the docs...`import httpclient↵var client = newHttpClient(sslContext=newContext(verifyMode=CVerifyPeer))` but I'm getting an error "`undeclared identifier: 'newContext'` . Any help would be much appreciated.
21:32:09FromDiscord<Elegantbeef> `import std/net`
21:32:46FromDiscord<daniellowrie (Daniel Lowrie)> sent a code paste, see https://play.nim-lang.org/#ix=4iCv
21:33:23FromDiscord<daniellowrie (Daniel Lowrie)> sent a long message, see http://ix.io/4iCw
21:35:44FromDiscord<daniellowrie (Daniel Lowrie)> That worked! Thanks @elegantbeef\:matrix.org !
21:35:59FromDiscord<Elegantbeef> Gitter is really a joke client now isnt it 😄
21:36:41FromDiscord<Elegantbeef> \For context overhere you typed my name + homeserver
21:37:00FromDiscord<Elegantbeef> Oh that's what it shows in gitter aswell
21:37:26FromDiscord<daniellowrie (Daniel Lowrie)> DOH!!! Sorry bout that
21:37:57FromDiscord<Elegantbeef> It doesnt really matter to me, i just find gitter very funny given how many things it does
21:38:18FromDiscord<Elegantbeef> Like code blocks are converted into HTML so are unreadable in discord land
21:38:38FromDiscord<daniellowrie (Daniel Lowrie)> Well that seems reasonable LOL
21:39:21FromDiscord<daniellowrie (Daniel Lowrie)> I haven't really used Gitter, so I'm just now experiencing all its glorious splendor
21:40:03FromDiscord<Elegantbeef> It's in a weird state now that it's matrix backed
21:48:48FromDiscord<a weird programmer> In reply to @a weird programmer "sounds like one hell": remember this
21:49:01FromDiscord<a weird programmer> i got a prototype working in python
22:01:15FromDiscord<c4ulmu> sent a code paste, see https://play.nim-lang.org/#ix=4iCE
22:04:12FromDiscord<Elegantbeef> You cannot make destroy hooks for ref objects
22:04:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iCF
22:05:12FromDiscord<c4ulmu> ok, I see. Thank you
22:11:57*tiorock joined #nim
22:11:57*tiorock quit (Changing host)
22:11:57*tiorock joined #nim
22:11:57*rockcavera quit (Killed (sodium.libera.chat (Nickname regained by services)))
22:11:57*tiorock is now known as rockcavera
22:13:30*doug_ quit (Ping timeout: 252 seconds)
22:16:43FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1052710755423768576/image.png
22:16:47FromDiscord<jos> why do my macros look like this
22:16:50FromDiscord<jos> am i doing something stupid
22:17:15FromDiscord<jos> is there like a library or something that makes reading the AST more ergonomic
22:17:41FromDiscord<jos> in rust with syn and dart's metaprogramming u actually have the whole AST strongly typed just in little structs, it reads quite nice
22:18:30FromDiscord<Gumbercules> There's an ast pattern matching library
22:18:44FromDiscord<Elegantbeef> https://github.com/beef331/micros/ exists
22:18:45FromDiscord<Elegantbeef> It doesnt cover the entire AST but it has a lot of it
22:19:07FromDiscord<Gumbercules> Rust doesn't offer the metaprogramming capabilities of Nim either...
22:19:27FromDiscord<Elegantbeef> technically my micros package also has a sort of pattern matching on AST
22:19:30FromDiscord<Gumbercules> And the AST is strongly typed.
22:19:55FromDiscord<Gumbercules> (edit) "the" => "Nim's"
22:20:07FromDiscord<Elegantbeef> But it's not a full on pattern matching you can just match based off node types
22:20:09FromDiscord<Elegantbeef> https://github.com/beef331/micros/blob/master/tests/tcasemacro.nim#L8-L43
22:20:14FromDiscord<Elegantbeef> Not the most clean solution 😄
22:24:46*jmdaemon joined #nim
22:27:33FromDiscord<Elegantbeef> I will say I very much think something like micros should be the "way to write macros", treating all AST as the same type is just a tedious API
22:27:56FromDiscord<Elegantbeef> In most cases no one needs to know the low level API a high level static typed API is much simpler to read
22:29:08*ltriant joined #nim
22:43:39FromDiscord<jos> In reply to @Gumbercules "And Nim's AST is": i can't remember why i have code like the screenshot above (i wrote it a long time ago) but i didn't see anything like "functionNode.arguments" and instead wrote stuff like "genericNode.child[4]"
22:43:45FromDiscord<jos> that's what i mean by strongly typed
22:43:47FromDiscord<jos> does that exist?
22:45:00FromDiscord<Gumbercules> In reply to @jos "does that exist?": Nim stores its AST in a tree structure similar to how you'd store a deserialized JSON object
22:45:42FromDiscord<Gumbercules> the AST needs to be dynamic to support the mutations that you can perform at compile time
22:46:22FromDiscord<Gumbercules> but no there isn't a type defined for every type of NimNode
22:46:25FromDiscord<Gumbercules> which is what I believe you're asking
22:46:27FromDiscord<jos> i think u could probably express it statically
22:46:32FromDiscord<jos> ye that's my question
22:46:42FromDiscord<Gumbercules> well it can be changed at comile time
22:46:53FromDiscord<Gumbercules> so expressing it statically can be difficult since it can also be mutated in a static context
22:47:08FromDiscord<Gumbercules> take for instance a node that represents a pragma
22:47:15FromDiscord<jos> that's true, i guess if you're actually literally mutating it instead of just `fn(ast) -> ast`
22:47:20FromDiscord<jos> it would be cumbersome
22:47:35FromDiscord<jos> it would still be nice to have a static way to access it for read, but i think that's what the ast pattern matching lib mentioned above was?
22:47:38FromDiscord<jos> i'll take a look at that
22:48:14FromDiscord<Gumbercules> let me link
22:48:27FromDiscord<Gumbercules> https://github.com/krux02/ast-pattern-matching
22:48:34FromDiscord<Gumbercules> take for instance a pragma node in the Nim AST
22:49:25FromDiscord<Gumbercules> pragmas are composed by combining different keywords - so the pragma itself is a dynamic collection of these keywords
22:49:29FromDiscord<Gumbercules> and you can invent custom pragmas
22:50:17FromDiscord<Gumbercules> many nodes in Nim's AST fall under this category where the can be composed of many different values - so yeah as you said you can imagine how this gets difficult to express in a static context
22:50:21FromDiscord<c4ulmu> Hey, I have another question. If I create a thread using `createThread` how do I return result of the execution (especially if it is a ref object) of this thread?↵I want to know how to do it without `spawn` and `threadpool`. I think I can use channels, but I thought maybe there is some other way? Maybe someone can explain how FlowVar do this?
22:50:33FromDiscord<Gumbercules> the reason Rust can be more explicit about things is because it can't do much of what Nim can via its macros
22:50:51FromDiscord<jos> makes sense-- thanks! i'll take a look at some of the libs ppl posted above
22:50:57FromDiscord<jos> if anyone knows any more lmk 🙂
22:53:47FromDiscord<Gumbercules> Rust's macros simply operate on a stream of tokens but doesn't work on the actual AST
22:54:14FromDiscord<Gumbercules> so Nim's macros are much closer to Lisp macros vs Rust/C++
22:55:01FromDiscord<! Nilts> Is it possible to iterate through the attributes of a type? It'd be useful for stuff like string reprs
22:55:07FromDiscord<Gumbercules> In reply to @c4ulmu "Hey, I have another": I don't think you can use `FlowVar` here - why don't you just have some global that you lock
22:55:21FromDiscord<Gumbercules> In reply to @not logged in "Is it possible to": `fields` I think?
22:55:37FromDiscord<Gumbercules> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
22:56:24FromDiscord<! Nilts> thanks!
22:56:47FromDiscord<Gumbercules> In reply to @Gumbercules "I don't think you": and if you want to know when it is set and the thread assigns it use a semaphore
22:57:12FromDiscord<Gumbercules> flowvars are using locks / semaphores anyway under the hood
22:57:34FromDiscord<Gumbercules> I think just using them yourself is much cleaner and more clear than using anything from `threadpool` but this is personal preference and coming from someone who does quite a bit of multithreading in Nim
22:58:05FromDiscord<Gumbercules> (note I don't use `threadpool` or any of Nim's higher level abstractions related to concurrency and parallelism`
22:58:17FromDiscord<Gumbercules> (edit) "parallelism`" => "parallelism)"
22:59:55*doug_ joined #nim
23:14:27FromDiscord<! Nilts> Anyone have a good list on the special procs in nim? like `$`, `[]` and `[]=`
23:18:57FromDiscord<Elegantbeef> They arent special they're just procs
23:19:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#lexical-analysis-operators
23:20:39FromDiscord<Phil> In reply to @Elegantbeef "https://github.com/beef331/micros/ exists": Question, you got docs for somebody trying to understand how to use micros assuming they have only very basic understanding of nim macros?
23:20:43FromDiscord<! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4iCV
23:26:45FromDiscord<Elegantbeef> I suppose i should do that
23:27:55FromDiscord<Phil> I can understand that that's highly annoying... but on the bright-side, if you use nimibook, you can make your CI pipelines break when your code changes enough to make your examples go out of date
23:27:58*doug_ quit (Remote host closed the connection)
23:28:06FromDiscord<Phil> So at least you can make sure that your docs are always valid
23:28:12FromDiscord<Elegantbeef> Or i can just use Nimdoc↵(@Phil)
23:28:33FromDiscord<Phil> Both sounds also pretty good!
23:28:44FromDiscord<Phil> One for reference, one for introduction
23:29:10FromDiscord<c4ulmu> Ohh, I have a lot of questions about multithreading in Nim!If I have a global hash table it is ref object (or has ref under the hood). Then I can't use it inside thread. Nim complains that I use gc unsafe staff.↵Is it ok to wrap hash table access code inside thread function in `{.gcsafe.}` and use lock to access hash table? Or it is considered as bad practice?↵(@Gumbercules)
23:30:03FromDiscord<Elegantbeef> The issue with making docs for a macro library is I dont want to explain macros in side the API 😄
23:31:25FromDiscord<Phil> That is fair, but I also have been trying to find my own "in" for learning macros and so far it's not been easy enough to pick up while at the same time I couldn't find something that grabbed me to the point of "I want to have that" that would lead to me biting my way towards enlightenment to get proficient with macros 😛
23:31:55FromDiscord<Phil> (edit) "macros" => "macros, so I'd love to try via learning through micros"
23:34:21FromDiscord<Elegantbeef> It's just such a hard thing to explain, all my tests are pretty much the best documentation i can think of
23:36:33FromDiscord<Elegantbeef> Like i dont see this being that helpful
23:36:33FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1052730850699116554/image.png
23:36:47*ltriant quit (Read error: Connection reset by peer)
23:37:14FromDiscord<Elegantbeef> If you use `orc` or `arc` you can do `{.cast(gcSafe).}:....`
23:38:06*ltriant joined #nim
23:39:08FromDiscord<Phil> In reply to @Elegantbeef "image.png": I mean, I understand you're defining the return type of the proc and changing it from "nothing" to "value given to the pragma"
23:39:12FromDiscord<Elegantbeef> gcSafe is to protect from race conditions of course, but Nim's multithreading doesnt really have fantastic methods of sharing without the new 'experimental' threading module at nim-lang/threading
23:39:25FromDiscord<Phil> I don't quite get why you're doing it 2 different ways and how they differ from one another though
23:39:37FromDiscord<Elegantbeef> The entire point is Macros vs micros here
23:39:55FromDiscord<Elegantbeef> They differ in that one way uses `std/macrs` the other uses `micros`
23:40:15FromDiscord<Elegantbeef> IE one is statically typed and cleaner 😛
23:44:50FromDiscord<Elegantbeef> With a global table you'd use `SharedPtr[Table[X, Y]]`
23:45:52FromDiscord<c4ulmu> Can you make a simple example, or may be send a link in docs?
23:46:11FromDiscord<c4ulmu> Sorry 😐
23:46:13FromDiscord<Elegantbeef> https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim#L97
23:46:53FromDiscord<Elegantbeef> I dont even know if `SharedPtr[Table[X, Y]]` works as one expects
23:52:04FromDiscord<c4ulmu> Ok, one last question for today. ↵If I have a deque of strings (or other ref objects) then I start threads and they pops elements from this deque (protected by lock and cast(gcsafe)). And I use Orc.↵Will this strings be moved to the threads and then gc'ed(cleaned up) by the threads?
23:52:47FromDiscord<Elegantbeef> Ownership should be given to the callsite
23:52:52FromDiscord<Elegantbeef> But dont take that as gospel
23:52:57FromDiscord<Elegantbeef> I hardly ever use multithreading 😄
23:53:50*brettgilio quit (Quit: The Lounge - https://thelounge.chat)
23:56:39FromDiscord<c4ulmu> I recently realized, that a lot of languages doesn't support normal threading.↵For example\: python, ruby, Lua, smalltalk, JavaScript. All single threaded (GIL)↵Even golang doesn't give you mess with threads directly only via scheduler and gorutines