<< 26-04-2021 >>

00:04:48*dsrw joined #nim
00:06:50FromDiscord<konsumlamm> wat
00:09:31FromDiscord<ElegantBeef> Did i stutter
00:12:30FromDiscord<konsumlamm> what has the one to do with the other?
00:12:48FromDiscord<ElegantBeef> They way i found to solve the former enables the latter
00:13:04FromDiscord<ElegantBeef> Since it changes int type reasoning
00:13:14FromDiscord<ElegantBeef> Without bounds checking
00:13:43FromDiscord<konsumlamm> is `byte` unsigned or signed?
00:13:46FromDiscord<ElegantBeef> unsigned
00:14:19FromDiscord<konsumlamm> then why would not allowing the latter be odd?
00:14:44FromDiscord<ElegantBeef> Cause in my current code if i support the former it allows the latter
00:15:24FromDiscord<ElegantBeef> The latter should be a compile error stating the literal is too large for the expected type
00:15:43FromDiscord<ElegantBeef> But right now it just compiles
00:15:48FromDiscord<konsumlamm> and how does supporting the former change that?
00:16:11FromDiscord<ElegantBeef> Cause it touches the int literal typing logic
00:16:25FromDiscord<ElegantBeef> Since it's not changing the array, but changing the literal values inside the array
00:18:01FromDiscord<konsumlamm> sounds like you have really weird typechecking code
00:20:16FromDiscord<ElegantBeef> I dont know what you mean
00:20:57FromDiscord<konsumlamm> i don't get in what universe supporting the former would require supporting the latter
00:22:46FromDiscord<ElegantBeef> Cause my current solution is subpar
00:23:03FromDiscord<ElegantBeef> And it's just inserting a call in the best place i can
00:24:30FromDiscord<garett> Is it possible to have a generic parameter of `proc` type?
00:25:08FromDiscord<konsumlamm> sure
00:28:53FromDiscord<ElegantBeef> My issue is mostly just that i dont like manually writing out the case statement to check if it's valid
00:29:16FromDiscord<ElegantBeef> Mostly cause it looks/sounds stupid 😄
00:41:31FromDiscord<checkersai> sent a code paste, see https://paste.rs/R2K
00:42:14FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/7C9
00:42:26FromDiscord<ElegantBeef> There are also experimental views to allow exactly what you asked
00:42:39FromDiscord<ElegantBeef> but those are experimental so... there be dragons
00:48:24FromDiscord<checkersai> cool
00:48:44FromDiscord<checkersai> I have another question. Is there a way to pass an immutable reference/pointer?
00:49:20FromDiscord<ElegantBeef> Strictfuncs are your friends when you want immutable reference types
00:49:31FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#strict-funcs
00:50:23FromDiscord<ElegantBeef> Nim's default procedures only make where the reference is pointing immutable(even in functions), strict funcs ensure you do not mutate variables not marked `var`
00:52:43*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:52:43FromDiscord<checkersai> Ok, strict funcs sound pretty usefull
00:53:02*njoseph joined #nim
00:53:59FromDiscord<checkersai> But, and this is purely hypothetical and out of curiosity, is there, for example, a way to pass a mutable reference and an immutable reference to the same function?
00:54:03FromDiscord<checkersai> (edit) "usefull" => "useful"
00:54:13FromDiscord<checkersai> (edit) "But, and this" => "This"
00:54:31FromDiscord<ElegantBeef> Yes `func name(yourVar: YourType)`
00:54:54FromDiscord<ElegantBeef> without `var` you can pass both immutable and mutable variables there
00:54:59FromDiscord<ElegantBeef> Just cannot mutate them
00:55:11FromDiscord<checkersai> Well that's no longer a reference, that's just a copy
00:55:20FromDiscord<ElegantBeef> Depends on teh size
00:55:23FromDiscord<ElegantBeef> (edit) "teh" => "the"
00:55:29FromDiscord<ElegantBeef> But eitherway that's not really an issue
00:55:40FromDiscord<checkersai> yeah
00:58:49*rockcavera quit (Remote host closed the connection)
00:59:01FromDiscord<ElegantBeef> View types are a pretty sweet idea for stuff like this, but not stable and may get reworked due to design issues
00:59:20*rockcavera joined #nim
01:01:48FromDiscord<checkersai> I was basically wondering if there was an equivalent of, like, passing a `const T`
01:02:07FromDiscord<checkersai> (edit) "T`" => "T`"
01:02:13FromDiscord<ElegantBeef> That's an immutable pointer?
01:02:56FromDiscord<checkersai> In C/C++ yeah. I think immutable is too strong a word though and I wrote that poorly
01:03:53FromDiscord<ElegantBeef> Well you can always use fusion's `ConstPtr` for that exact mirror, but strict funcs are the only way to ensure the reference cannot be mutated afaik
01:04:07ForumUpdaterBotNew thread by Tmsa04: What to use instead of TaintedString?, see https://forum.nim-lang.org/t/7858
01:27:54*dsrw quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:36:06*dsrw joined #nim
01:50:33*dsrw quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
02:11:01giacoI keep being affected by the problem that vscode fills up ram while working with nim + nimsaem extension. Htop shows dozed of nimsuggest processes running
02:11:46giacoif I don't restart vscode every four hours or so, system hangs and not even ctrl-alt-canc works, I have to hard reboot
02:27:06*thomasross quit (Ping timeout: 260 seconds)
02:51:59*zopsi quit (Max SendQ exceeded)
02:52:32*zopsi joined #nim
03:13:18leorize[m]saem: ^
03:27:06saemgiaco: IIRC you set the "nim.project" setting in `.vscode/settings.json` for that code base?
03:39:53FromDiscord<flywind> Now Nim compiles faster on this benchmark https://github.com/nordlow/compiler-benchmark
03:40:10FromDiscord<flywind> after applying some strategies.
03:42:01saemSome strategies?
03:42:56FromDiscord<ElegantBeef> They said "Compile it faster or i'll unplug your PSU"
03:43:03FromDiscord<ElegantBeef> Makes the computer go into overdrive
03:43:09FromDiscord<flywind> turn off stacktrace and checks
03:43:11FromDiscord<flywind> https://github.com/nordlow/compiler-benchmark/pull/11
03:46:09saemSadly, I doubt those are flags that most people would opt for in most cases.
03:47:53FromDiscord<flywind> well, disabling it just for this toy benchmark, because the benchmark is so simple to cover the real world example.
03:48:11FromDiscord<flywind> (edit) "so" => "too"
03:54:01FromDiscord<flywind> What we really need is to monitor compile time https://github.com/timotheecour/Nim/issues/425
03:54:17*spiderstew joined #nim
03:54:22FromDiscord<Rika> yeah i think the stacktrace and checks off version is kinda misleading
03:54:23FromDiscord<flywind> Or profile compiler
03:54:41FromDiscord<ElegantBeef> Yall dont just `-d:danger` everything?
03:55:37*spiderstew_ quit (Ping timeout: 252 seconds)
03:56:18FromDiscord<ElegantBeef> I dont even get what that benchmark is doing 😄
04:01:59FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/836089702481264680/unknown.png
04:02:06FromDiscord<flywind> is it a regression?
04:02:29FromDiscord<flywind> may be related to https://github.com/nim-lang/Nim/pull/17730
04:02:34FromDiscord<flywind> I guess
04:03:28FromDiscord<ElegantBeef> Probably
04:08:59FromDiscord<Rika> plugin should deal with it then
04:09:17FromDiscord<ElegantBeef> Quick throw saem under the bus and run as the bus goes "ka-thonk"
04:12:51FromDiscord<flywind> well same result with saem's plugin
04:13:20FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/836092557799981116/unknown.png
04:16:17saemthe plugin can only do so much. cross platform process control is ... sketchy
04:16:42FromDiscord<flywind> ?
04:16:59FromDiscord<flywind> this happen with devel and works with stable release
04:17:18FromDiscord<flywind> may/should be caused by https://github.com/nim-lang/Nim/pull/17730
04:17:22saemSorry, I'm replying to an earlier message, so it's a bit disjoin.
04:17:30FromDiscord<flywind> I see
04:25:24*narimiran joined #nim
04:37:41*Q-Master quit (Ping timeout: 240 seconds)
04:40:46*Q-Master joined #nim
04:54:30FromDiscord<ElegantBeef> Ah so it seems semexpr happens after range checking happens so changing the type doesnt get it to ensure it's in that range, so i guess i either implement that myself or disregard this weird inference 😄
05:02:50saemHmm, might be the whole generic deferred checking thing too
05:13:19*rockcavera quit (Remote host closed the connection)
05:30:33*kitech1- quit (Ping timeout: 240 seconds)
05:31:50*kitech1 joined #nim
05:47:29ForumUpdaterBotNew post on r/nim by oakes: ANSIWAVE - an ANSI art and MIDI music editor, see https://reddit.com/r/nim/comments/myqow0/ansiwave_an_ansi_art_and_midi_music_editor/
05:55:35FromDiscord<ElegantBeef> Saem i'm sure you've done similar things to what i'm doing now, looking at a function call that is the reason your code isnt working, then deleting it and run the tests to see "how" important it was
05:56:21FromDiscord<ElegantBeef> Seems comical considering how many tests pass, so clearly edge case 😄
06:17:11*Vladar joined #nim
06:17:48saem@ElegantBeef: yup that's a thing or throwing asserts in there.
06:18:03saemI'm working on something that would potentially help in that scenario.
06:18:45saemnot going to lie, it's a ways off but you might be interested.
06:28:36FromDiscord<ElegantBeef> Lol in good styling now erroring on the CI, i was confident it was golden! 😄
06:46:21*PMunch joined #nim
08:24:23*notchris quit (Read error: Connection reset by peer)
08:24:38*raboof quit (Read error: Connection reset by peer)
08:25:17Clonkk[m]So today is an interesting morning where nimsuggest made my computer crash three times in two hours by hogging all the CPU
08:27:16Clonkk[m]Is it possible to at least start nimsuggest with ``nice`` option on Linux so it's doesn't freeze everything ?
08:30:04*raboof joined #nim
08:30:05*notchris joined #nim
08:33:41*hyiltiz quit (Ping timeout: 240 seconds)
08:38:32*hyiltiz joined #nim
08:38:33*hyiltiz quit (Changing host)
08:38:33*hyiltiz joined #nim
08:48:57PMunchOh damn, I've never had it completely freeze my computer before
08:50:17FromDiscord<whisperdev> Is it possible to install older version of pkg via nimble?
08:50:31PMunchShould be, yeah
08:50:37PMunchCan't remember the syntax though
08:52:43FromDiscord<whisperdev> pkg@version
08:52:43FromDiscord<whisperdev> thx
08:57:52PMunchHaha, you're welcome. Not that I really did much :P
09:03:48FromDiscord<whisperdev> I think nimble sucks 😐
09:04:29FromDiscord<impbox [ftsf]> constructive
09:23:08*giaco quit (Ping timeout: 265 seconds)
09:26:00FromDiscord<Rika> Why does it such
09:26:02FromDiscord<Rika> Suck
09:26:39ForumUpdaterBotNew post on r/nim by WrongJudgment6: Is there a list of developers working in Nim that someone can support?, see https://reddit.com/r/nim/comments/mytp3j/is_there_a_list_of_developers_working_in_nim_that/
09:30:29*giaco joined #nim
09:43:14FromDiscord<impbox [ftsf]> weird place to post it
09:43:40FromDiscord<impbox [ftsf]> (or maybe not, didn't realise there was a nim reddit)
09:54:25*kwilczynski quit ()
09:54:54*kwilczynski joined #nim
10:10:25FromDiscord<dabmlfz> Stacktrace of exceptions thrown from an async function(ran using waitFor) points to the macro and not where the exception happened. Is this default behavior or is there something that can be done about it?
10:28:21*vicfred quit (Quit: Leaving)
10:59:04FromDiscord<exelotl> I'm still waiting for treeform to start a patreon :P
11:20:06*PMunch quit (Ping timeout: 240 seconds)
11:20:34*PMunch joined #nim
11:30:25*Vladar quit (Remote host closed the connection)
11:33:56*dsrw joined #nim
11:35:44*Vladar joined #nim
11:50:04giacoit there a way to list unused code in project when compiling?
11:50:40FromDiscord<zetashift> You should get automatic warnings if code declared is not used
11:53:24FromDiscord<flywind> see https://github.com/jyapayne/mort
11:56:49FromDiscord<flywind> see also https://github.com/timotheecour/Nim/issues/245
11:57:11FromDiscord<flywind> and upvote this PR https://github.com/nim-lang/Nim/pull/15827 if you want better test coverage support
12:10:47FromDiscord<jtiai> Is there any IDE for Nim? I've been using vscode but it's integreation with nimble and other nim tools isn't that great.
12:11:55PMunchThere was one, but it's been discontinued for a long time. VSCode is seen as the currently best way of using Nim at the moment, but I haven't tried it myself so I can't speak to how it stacks up to my Vim based environment.
12:28:45dsrw@jtiai The Nim IntelliJ plugin has a lot of promise. I do all of my Nim coding with it these days.
12:29:04dsrwIt's still really young though, so there are definitely rough edges and missing features.
12:29:45FromDiscord<jtiai> Hmm... I think I have IDEA ultimate...
12:34:21dsrw@jtiai It might be worth checking out then. Currently it doesn't really integrate with nimble, but intellij's file watcher and external tool features cover most of what I need there.
12:36:12dsrwI don't think it's an official JetBrains product, but it's being developed by a JetBrains employee. It really is very early, so keep your expectations low, but I like it a lot.
12:37:01dsrwYou don't need Ultimate to run it, but I think you do if you want debugger support. I use it with CLion personally.
12:39:39FromDiscord<jtiai> Have to check. I just had a license for ultimate... I just have a clue why.
12:46:39ForumUpdaterBotNew thread by Drkameleon: Error when building for JS - internal error, see https://forum.nim-lang.org/t/7859
12:46:49dsrwOk. You'll probably need a fairly recent version of Ultimate to run it, but IntelliJ or PyCharm community should work fine, apart from debugger integration.
12:50:22FromDiscord<jtiai> I have pycharm pro as well due dayjob. 🙂
12:51:44stefantalpalaruIs it possible for a string to be GC-ed even though I have a cstring holding a pointer to the string's buffer?
12:53:16*natrys joined #nim
12:53:51FromDiscord<Rika> all strings are GCable are they not?
12:54:24FromDiscord<Rika> if by pointer you mean taken by `addr` then i believe that doesnt increment its RC
12:54:27*rockcavera joined #nim
12:55:55FromDiscord<Zachary Carter> yeah that's correct because it's an unmanaged reference
12:55:57FromDiscord<Zachary Carter> or pointer
12:59:47stefantalpalaruI mean: var cstr: cstring; var str = "foo"; cstr = str; # now str is garbage-collected even if I hold on to cstr?
13:01:49leorize[m]yes, it is garbage collected the moment you drop str (a bit more complicated than that with arc though)
13:01:50leorize[m]cstring "conversion" is actually dangerous
13:02:04stefantalpalaruNow you tell me :-)
13:02:08PMunchWait, really?
13:02:28PMunchI mean it makes sense, but I never even considered that
13:03:05leorize[m]with arc then str is only collected after the containing block went out of scope
13:03:35leorize[m]and there are some very weird definition of what constitutes a collectible block :p
13:03:44stefantalpalaruI'm using teh default GC and I was expecting pointers to be absolute GC-blockers due to stack scanning.
13:04:00stefantalpalaru(And heap scanning)
13:04:38leorize[m]the inner buffer is not really tracked, I believe the GC only keep tabs of the outer object
13:04:59stefantalpalaruBut it's right at the start of the string object.
13:05:12stefantalpalaruSo the cstring pointer is the same as a string pointer.
13:05:22leorize[m]well cstring conversion doesn't increase the ref count
13:06:00leorize[m]deterred ref counting still makes decisions based on the reference count afaik
13:06:40stefantalpalaruBut ref counting in the default, tracing GC, is just an extra feature, not the main mechanism.
13:06:54leorize[m]you should adopt a better resource management scheme anyway, since orc is gonna be the future
13:07:40leorize[m]though I'm not quite sure that the collected ptr is the beginning of the string buffer
13:07:42stefantalpalaruOr maybe there's a header before the buffer in the string object.
13:07:53leorize[m]we do have length and capacity encoded too
13:08:28stefantalpalaruI can get the buffer pointer with "addr(str[0])" but that's just a Nim trick.
13:08:42stefantalpalaruSays nothing about where that is inside the string object.
13:09:03leorize[m]the string object is opaque, unfortunately
13:09:28leorize[m]you can read it's implementation in gc.nim iirc
13:12:42ForumUpdaterBotNew thread by Dabod: How to create const object of non-root object type, see https://forum.nim-lang.org/t/7860
13:14:18stefantalpalaruHere it is: https://github.com/nim-lang/Nim/blob/e70044fb280909a2da15dc763c9c549a4857632f/lib/system.nim#L532
13:14:52stefantalpalaruStrings are sequences with an extra "data" field for the cstring buffer.
13:22:43ForumUpdaterBotNew thread by FabienPRI: Unzip multipart zip file, see https://forum.nim-lang.org/t/7861
13:43:32*NimBot joined #nim
13:55:50*rockcavera quit (Remote host closed the connection)
13:56:37FromDiscord<dom96> Any use of addr or ptr is dangerous in Nim. Everyone should be aware of this.
13:58:55PMunchcstring isn't obvious that uses a pointer though, or it's not obvious that it isn't doing that in a safe way
13:59:33*rockcavera joined #nim
14:04:24Clonkk[m]Anything involving should be considered dangerous
14:04:34Clonkk[m] * Anything involving C directly should be considered dangerous
14:25:32*Northstrider[m] quit (Quit: Bridge terminating on SIGTERM)
14:26:51ForumUpdaterBotNew thread by Tsojtsoj: How to definitely free memory of seq?, see https://forum.nim-lang.org/t/7862
14:35:36*Northstrider[m] joined #nim
14:40:02FromDiscord<mlokis> is there some idiomatic way to get first element of `set[T]`
14:41:40FromDiscord<Rika> there is no such thing as a "first element" when a set is unordered, i would argue
14:44:19FromDiscord<mlokis> there is one element in the set and i want to read it
14:46:29FromDiscord<mlokis> i just need to know what that last element is without doing contains calls
14:46:39FromDiscord<mlokis> (edit) "what" => "what`s"
14:48:11FromDiscord<mlokis> (edit) "element is" => "element,"
14:48:18*PMunch quit (Quit: leaving)
14:54:54ForumUpdaterBotNew thread by Miran: NimConf 2021, see https://forum.nim-lang.org/t/7863
14:55:26FromDiscord<mlokis> oh i just have to convert it to seq
16:12:00FromDiscord<Hi02Hi> yes nimconf is back!
16:12:36*grimler32 joined #nim
16:15:14grimler32any universe editors with access to the 4 bit 3 dimensional god code at the multiverse level?
16:15:30*superbia joined #nim
16:19:58FromDiscord<Hi02Hi> if a function never uses result, does nim realize this and never initialize it?
16:27:17giacoIm getting this warning from times.nim: "'parse' cannot raise 'Defect' [XCannotRaiseY]"
16:27:19FromDiscord<garett> Is there a Nim equivalent of C++ nullptr_t?
16:29:15FromDiscord<haxscramper> `typeof(nil)`
16:30:19FromDiscord<haxscramper> I'm not sure if I remember how `nullptr_t` typdefed in C++, and `typeof()` nim solution might not be fully equivalent because of more strict typing guarantees (i.e. nim
16:30:41FromDiscord<garett> Thanks
16:31:35Clonkk[m]You can also import nullptr_t in Nim directly if you target C++ backend, if your goal is C++ interop
16:33:12FromDiscord<garett> I was trying to write `==` to compare an Id type to `nil`
16:34:49*vicfred joined #nim
16:36:15FromDiscord<garett> It worked, but I decided against it
16:43:10*reversem3 quit (Changing host)
16:43:10*reversem3 joined #nim
16:43:10*reversem3 quit (Changing host)
16:43:10*reversem3 joined #nim
17:02:48FromGitter<DylanModesitt> SESCO, a quant commodities (largely energy) trading firm, is interested in hiring nim programers to work on large-scale physics simulations, generative models for trading in auctions, data-intensive systems & applications, etc. Email [email protected] if you are interested & we can talk!
17:14:05FromDiscord<haxscramper> There is a `#science` channel on discord/IRC and `#announcements`. Someone with permissions should probably put this into announcements, so that it won't disappear too quickly
17:23:47reversem3Newbie question: When would you want to create a new operator?
17:24:28reversem3meaning creating a new character `+` `-` `*` etc....
17:25:04FromDiscord<haxscramper> ``proc`+`(a, b: string): string = a & b``
17:25:26FromDiscord<haxscramper> Just put procedure name in the backticks https://nim-lang.org/docs/manual.html#lexical-analysis-operators
17:25:45reversem3for what though ? just to make it faster ?
17:25:46FromDiscord<treeform> sent a code paste, see https://paste.rs/lM3
17:26:11FromDiscord<haxscramper> For making it easier to write domain-specific code without having `multiply` vs ``
17:26:26FromDiscord<haxscramper> E.g. matrix mulitiplication
17:26:35reversem3ok thats what I though , so really only in metaprogramming
17:26:39FromDiscord<haxscramper> no
17:26:54reversem3 * ok thats what I thought, so really only in metaprogramming
17:27:02FromDiscord<haxscramper> `[]` is a custom operator, but you create it each time you write container-like types
17:27:07FromDiscord<treeform> I mostly implement `+` `-` `` when I have my own mathy-number types like vectors, matrices, fixpoint numbers etc...
17:27:31FromDiscord<haxscramper> `$` is the most common operator
17:27:52reversem3yeah I see it a lot in code
17:27:53FromDiscord<haxscramper> most common custom operator that you might want to reimplement
17:28:08FromDiscord<treeform> In reply to @ElegantBeef "*still have to clean": Really that's nice. I would like to see it working!
17:28:51reversem3ok thanks I have a better understanding now
17:31:04*tane joined #nim
17:31:54FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3cAU
17:32:14FromDiscord<haxscramper> someone certainly had a lot of fun coming up with these operator names like `+++`
17:40:05reversem3<FromDiscord "<haxscramper> sent a code paste,"> Empty ?
17:41:57FromDiscord<haxscramper> I omitted some not boring ones like `&&`. Full list is https://play.nim-lang.org/#ix=3cCr
17:43:15reversem3damn
18:23:42*blackpawn quit (Ping timeout: 268 seconds)
18:37:37*superbia quit (Quit: WeeChat 3.1)
18:47:14reversem3getting 502 http errors from playground , so uploading a pic instead , sorry
18:47:20*reversem3 uploaded an image: (177KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/IBoMSVnQZDDIMZSLdpbdSkve/image.png >
18:48:39*Vladar quit (Quit: Leaving)
18:48:45reversem3Ok so the two procs one has a return the other does not , so my question is why don't echo work for the first one , is it because echo is a return proc ?
18:58:16FromDiscord<exelotl> `echo` doesn't return anything, it's just a proc that prints text followed by a newline
18:59:09reversem3So why can't you echo the first proc ?
18:59:48FromDiscord<exelotl> the reason the second one compiles is because your echoLanguageRating implicitly returns an empty string (since you never returned a value from it, nor did you set the implicit `result` variable)
18:59:54FromDiscord<exelotl> so x has the value ""
19:00:12FromDiscord<exelotl> and your `echo x` just prints an extra newline
19:01:12reversem3The first one does compile though
19:02:26FromDiscord<exelotl> yes, but you can't echo it because the proc itself has no return type (or rather it has an implicit `void` return type, which means it returns nothing)
19:03:59reversem3even though when I run it on commandline with nim c it returns
19:04:22reversem3Hint: 22427 lines; 0.984s; 25.469MiB peakmem; Debug build; proj: /Users/.env/nim/nim_in_action/echo_language.nim; out: /Users/.env/nim/nim_in_action/echo_language [SuccessX]
19:04:22reversem3Hint: /User/.env/nim/nim_in_action/echo_language [Exec]
19:04:22reversem3Nim is the best language!
19:04:56reversem3I'm not trolling I'm just curious , I get no return type
19:05:32FromDiscord<exelotl> > even though when I run it on commandline with nim c it returns "Nim is the best language!"
19:05:38FromDiscord<exelotl> this is not exactly true
19:05:45FromDiscord<d4rckh> is this the right channel to get help with some issues coding in nim?
19:06:15FromDiscord<exelotl> it outputs "Nim is the best language!" but it doesn't return it
19:06:53FromDiscord<d4rckh> im trying to make a little web fuzzer in nim but i have a little problem with
19:07:13FromDiscord<exelotl> @d4rckh yep!
19:08:04reversem3ok thanks @exelotl
19:08:16FromDiscord<d4rckh> sent a code paste, see https://paste.rs/TMT
19:09:32FromDiscord<d4rckh> sent a code paste, see https://paste.rs/Qfl
19:09:34FromDiscord<d4rckh> actually heres more code
19:09:45FromDiscord<d4rckh> (edit) "https://paste.rs/qtq" => "https://paste.rs/YYu"
19:10:27FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3cQv" => "https://paste.rs/4Bk"
19:10:53FromDiscord<haxscramper> The problem is missing text before 2001? Try `echo words` to see if the sequence contains all strings as you expect
19:11:54FromDiscord<d4rckh> oh, theres a weird control character `\c`, i assume it means end of text or something?
19:12:29FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3cQN
19:12:51FromDiscord<haxscramper> Yes, `split("\n")` is not really suitable for line separation, instead you should do `for word in lines(inputFile)`
19:13:18FromDiscord<haxscramper> `lines` is an iterator so it must be used in the `for` loop, but it accounts for windows-specific line separators
19:13:23FromDiscord<d4rckh> and inputFile is open(path) instead of readFile(path) ?
19:14:18FromDiscord<haxscramper> https://nim-lang.org/docs/io.html#lines.i%2Cstring you need to pass a filename to `lines` iteartor, so in your case it would be just `wordlist`
19:14:34FromDiscord<haxscramper> I missed that you had file reading at the very top, sorry
19:14:58FromDiscord<d4rckh> ah ok
19:14:59FromDiscord<exelotl> reversem3: https://play.nim-lang.org/#ix=3cRc
19:15:07FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3cRg
19:15:14FromDiscord<d4rckh> thank you
19:15:17FromDiscord<d4rckh> thats useful 😛
19:26:59FromDiscord<d4rckh> @haxscramper how would i go about splitting a string without having these characters inserted?
19:28:38reversem3<FromDiscord "<exelotl> nixfreak: ">https://play"> Ok so if no return type you can't assign it to a variable , make sense thanks again
19:28:45FromDiscord<haxscramper> You need to have some separators in the string in order to split it. Comma, tab, space etc. You just want to store list of words in a file, correct?
19:29:25reversem3<reversem3 "Ok so if no return type you can'"> so would there ever be a time where you wouldn't want a return type?
19:29:30FromDiscord<d4rckh> sent a code paste, see https://paste.rs/oZH
19:29:36FromDiscord<d4rckh> but when i do it, i get a `\c` at the beginning
19:32:39FromDiscord<haxscramper> In reply to @d4rckh "okay lets say i": You can split on `\c\n--\c\n` (or `\n\c`, I don't know in which order they are on windows)
19:33:28FromDiscord<haxscramper> Because your file is essentially a `part1\c\n--\c\npart2` if I'm not mistaken, so you need to account for all `\n` and `\c` when choosing string to split on
19:33:51FromDiscord<d4rckh> right
19:40:36FromDiscord<exelotl> reversem3: yes, you don't want a return type for a procedure that does some action but doesn't result in a value
19:41:10FromDiscord<exelotl> for example, `writeFile` is a procedure that saves some text to a file
19:41:19FromDiscord<exelotl> it doesn't make sense for it to return a value
19:42:35*abm joined #nim
19:44:11reversem3@exelotl oh ok that makes sense
20:24:06*clyybber joined #nim
20:28:17*dsrw quit (Quit: Textual IRC Client: www.textualapp.com)
20:28:25*narimiran quit (Ping timeout: 260 seconds)
20:44:44*tane quit (Quit: Leaving)
20:56:48*Guest86869 quit (Ping timeout: 246 seconds)
20:59:20*JStoker joined #nim
21:01:05*l1x quit (Quit: Connection closed for inactivity)
21:04:05FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3d8R
21:04:22FromDiscord<haxscramper> And how I can make all constant symbols to be passed as symbols?
21:06:12FromDiscord<haxscramper> Or do I have to pass mix `typed` and `untyped` arguments where I repeat each constant only to get the name of the symbol? Like `macro storeTraits(raw: untyped, sym: typed, raw1: untyped, sym1: typed ...`
21:06:21leorize[m]typed ast is not spec-ed unfortunately
21:06:46FromDiscord<haxscramper> Which means "good luck handling edge cases"?
21:07:03leorize[m]good luck using it at all
21:07:53leorize[m]the cps effort might bring some more consistency to typed ast but we also have to walkaround compiler bugs
21:08:37FromDiscord<ElegantBeef> Not overly lovely but you can use dynamicbindsym
21:08:39FromDiscord<haxscramper> Thankfully I've avoided most of the issues with typed ast, but that `const` one got me in the end
21:08:44FromDiscord<ElegantBeef> then just pass in them as untyped
21:09:08FromDiscord<ElegantBeef> Though afaik that requires you to then include the module with this macro so it can bind in the properscope
21:10:21FromDiscord<haxscramper> In reply to @haxscramper "Or do I have": I will try using this hack first, because `Experimental feature: use {.experimental: "dynamicBindSym".}` and untyped AST would probably cause critical damage to my sanity
21:10:33FromDiscord<haxscramper> typed AST
21:10:41FromDiscord<haxscramper> (edit) "untyped" => "typed"
21:14:35FromDiscord<haxscramper> In reply to @leorize "good luck using it": From earlier discussions about typed AST specification it seems like one of the main issues is that nobody really knows how exactly things should work, correct? There are things like https://github.com/nim-lang/RFCs/issues/44
21:14:57*rockcavera quit (Remote host closed the connection)
21:14:58FromDiscord<haxscramper> And maybe other RFCs, but they don't exactly cover all use cases
21:15:14leorize[m]yea, we don't have much standardization in this area
21:15:20FromDiscord<haxscramper> Like enum turning into `IntLit` in branch fields
21:15:25leorize[m]cps is currently the biggest user of typed macros
21:15:36*rockcavera joined #nim
21:15:56leorize[m]I think @clyybber would know a bit more about this subject
21:16:36*rockcavera is now known as Guest94443
21:16:36*Guest94443 quit (Killed (tolkien.freenode.net (Nickname regained by services)))
21:16:37*rockcavera joined #nim
21:16:46FromDiscord<haxscramper> Would it be a good idea to make a "compilation" RFC in order to bring together all edge cases? Not a specific proposal, but sort of "one place with all concrete issues"?
21:17:23FromDiscord<haxscramper> E.g. I'm working on typed/untyped object parsing and there is a lot of strange things going on with `getTypeImpl()` and case objects
21:18:31*tiorock joined #nim
21:18:31*tiorock quit (Changing host)
21:18:32*tiorock joined #nim
21:18:32*rockcavera quit (Killed (orwell.freenode.net (Nickname regained by services)))
21:18:32*tiorock is now known as rockcavera
21:22:11*thomasross joined #nim
21:23:13leorize[m]A meta issue for typed ast would be nice
21:25:13*thomasross quit (Max SendQ exceeded)
21:25:41*thomasross joined #nim
21:45:33*jess quit ()
21:46:10FromDiscord<haxscramper> In the end I resolved this using `for c in consts: result.add nnkPar.newTree(newLit(c.strVal()), c)` and then unpacking generated const name tuples
21:46:20FromDiscord<haxscramper> Via multi-stage macro
21:47:24FromDiscord<haxscramper> I suppose introducing typed AST specification would break some things, though I feel it is a very niche usage for those who are brave enough to dive into `typed` AST structure
21:50:01leorize[m]it's not niche
21:50:02leorize[m]typed ast is the only way to reliably compose macros
21:51:27FromDiscord<haxscramper> It is used less often (noticeably less often), partly because it is so full of unexpected edge cases. At least from my understanding
21:52:25FromDiscord<haxscramper> Especially when building complex macros
21:55:27leorize[m]they are not edge cases if there are tons of them, right?
21:55:33leorize[m]we lack a formal spec to deal with special nodes within the typed ast structure
21:55:35leorize[m]nnkHidden* family of nodes come to mind
21:57:04FromDiscord<haxscramper> `s/edge cases/unexpected behaviors when changing type of the symbol can change it's AST representation, counter-intuitive node transformations that wasn't clear even after digging into compiler implementation and things that other people found annoying or hard to work with like #44/`
21:58:03FromDiscord<haxscramper> well, I should probably say "inconsistent behavior" rather than "edge case"
22:04:58FromDiscord<ElegantBeef> Just go for the naive `typed` and `typedbody` the former only accepts symbols, the latter converts them to their impl 😛
22:08:39*tiorock joined #nim
22:08:39*tiorock quit (Changing host)
22:08:39*tiorock joined #nim
22:08:39*rockcavera is now known as Guest69447
22:08:39*Guest69447 quit (Killed (hitchcock.freenode.net (Nickname regained by services)))
22:08:39*tiorock is now known as rockcavera
22:09:12FromDiscord<haxscramper> I'm writing (upgrading my IR for object/enum representation) and I had to take in `typed` object representation and then `getTypeInst()` but resolve all identifiers in case branches to concrete enum values. And because you can do things like `const kindGroup = { ... }` I had to unparse constants. The only part where I got completely stuck is my question above
22:09:33FromDiscord<haxscramper> Everything else can be characterized as "annoying but probably expected"
22:10:47*xet7 quit (Remote host closed the connection)
22:11:49*xet7 joined #nim
22:13:31*natrys quit (Quit: natrys)
22:14:25FromDiscord<retkid> nim is like 98% the speed of C right
22:15:19FromDiscord<Recruit_main707> basically, give or take depending on the usecase
22:15:27FromDiscord<ElegantBeef> Yea purely depends on usecase/code
22:15:51FromDiscord<haxscramper> You can get over 100% for speed sometimes due to compiler optimizations
22:16:09FromDiscord<ElegantBeef> Yea there is no one definitive percentage
22:16:09FromDiscord<haxscramper> I think I've seen it a couple of times
22:16:27FromDiscord<ElegantBeef> Nim can be fast if written write and you actually build `-d:release`
22:16:33FromDiscord<ElegantBeef> (edit) "write" => "right"
22:16:43FromDiscord<retkid> yea so its IN an around the speed of C
22:16:48FromDiscord<retkid> (edit) "an" => "and"
22:16:50FromDiscord<ElegantBeef> Sure
22:16:52FromDiscord<retkid> if you write the code rightg
22:16:53FromDiscord<retkid> (edit) "rightg" => "rightt"
22:18:31FromDiscord<haxscramper> Most of the time you don't need to worry about that ... too much. Naive sequence/string operations that reallocate all the time would be a performance hit, so some caution is needed to avoid common pitfalls
22:18:51FromDiscord<ElegantBeef> term rewritting protections when? 😛
22:19:16FromDiscord<haxscramper> 9k macro instantiations
22:22:15FromDiscord<retkid> In reply to @haxscramper "Most of the time": The first python script i ever had to like, use my brain to optimize took 4 minutes to write
22:22:21FromDiscord<retkid> i did 13 needless re operation
22:22:26FromDiscord<retkid> and read from a file 14 needless times
22:22:36FromDiscord<retkid> (edit) "4" => "4-8"
22:23:06FromDiscord<retkid> (edit) "optimize" => "fix, it" | "4-8" => "like 8" | "write" => "complete operation"
22:23:12FromDiscord<ElegantBeef> It's like people that use `split` and only read from the string
22:23:40FromDiscord<retkid> they never save the partition or the spli
22:23:40FromDiscord<ElegantBeef> maybe just make a proc that takes a string and a start/end 😄
22:23:41FromDiscord<retkid> (edit) "spli" => "split"
22:23:43FromDiscord<retkid> they just keep doing it
23:12:40*wasted_youth2 quit (Quit: Leaving)
23:14:08*teal joined #nim
23:15:55*clyybber quit (Quit: WeeChat 3.1)
23:16:25FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3duM
23:18:13FromDiscord<exelotl> guess I'd have to use a template instead of an iterator
23:24:25*teal quit (Quit: WeeChat 3.1)
23:31:21FromDiscord<ElegantBeef> Well you can always use a defer instead, but yea same principle
23:32:19FromDiscord<exelotl> yeah I'm working under --os:standalone --gc:none so I don't think I can use try..catch
23:33:21FromDiscord<exelotl> (or defer)