00:04:48 | * | dsrw joined #nim |
00:06:50 | FromDiscord | <konsumlamm> wat |
00:09:31 | FromDiscord | <ElegantBeef> Did i stutter |
00:12:30 | FromDiscord | <konsumlamm> what has the one to do with the other? |
00:12:48 | FromDiscord | <ElegantBeef> They way i found to solve the former enables the latter |
00:13:04 | FromDiscord | <ElegantBeef> Since it changes int type reasoning |
00:13:14 | FromDiscord | <ElegantBeef> Without bounds checking |
00:13:43 | FromDiscord | <konsumlamm> is `byte` unsigned or signed? |
00:13:46 | FromDiscord | <ElegantBeef> unsigned |
00:14:19 | FromDiscord | <konsumlamm> then why would not allowing the latter be odd? |
00:14:44 | FromDiscord | <ElegantBeef> Cause in my current code if i support the former it allows the latter |
00:15:24 | FromDiscord | <ElegantBeef> The latter should be a compile error stating the literal is too large for the expected type |
00:15:43 | FromDiscord | <ElegantBeef> But right now it just compiles |
00:15:48 | FromDiscord | <konsumlamm> and how does supporting the former change that? |
00:16:11 | FromDiscord | <ElegantBeef> Cause it touches the int literal typing logic |
00:16:25 | FromDiscord | <ElegantBeef> Since it's not changing the array, but changing the literal values inside the array |
00:18:01 | FromDiscord | <konsumlamm> sounds like you have really weird typechecking code |
00:20:16 | FromDiscord | <ElegantBeef> I dont know what you mean |
00:20:57 | FromDiscord | <konsumlamm> i don't get in what universe supporting the former would require supporting the latter |
00:22:46 | FromDiscord | <ElegantBeef> Cause my current solution is subpar |
00:23:03 | FromDiscord | <ElegantBeef> And it's just inserting a call in the best place i can |
00:24:30 | FromDiscord | <garett> Is it possible to have a generic parameter of `proc` type? |
00:25:08 | FromDiscord | <konsumlamm> sure |
00:28:53 | FromDiscord | <ElegantBeef> My issue is mostly just that i dont like manually writing out the case statement to check if it's valid |
00:29:16 | FromDiscord | <ElegantBeef> Mostly cause it looks/sounds stupid 😄 |
00:41:31 | FromDiscord | <checkersai> sent a code paste, see https://paste.rs/R2K |
00:42:14 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/7C9 |
00:42:26 | FromDiscord | <ElegantBeef> There are also experimental views to allow exactly what you asked |
00:42:39 | FromDiscord | <ElegantBeef> but those are experimental so... there be dragons |
00:48:24 | FromDiscord | <checkersai> cool |
00:48:44 | FromDiscord | <checkersai> I have another question. Is there a way to pass an immutable reference/pointer? |
00:49:20 | FromDiscord | <ElegantBeef> Strictfuncs are your friends when you want immutable reference types |
00:49:31 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#strict-funcs |
00:50:23 | FromDiscord | <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:43 | FromDiscord | <checkersai> Ok, strict funcs sound pretty usefull |
00:53:02 | * | njoseph joined #nim |
00:53:59 | FromDiscord | <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:03 | FromDiscord | <checkersai> (edit) "usefull" => "useful" |
00:54:13 | FromDiscord | <checkersai> (edit) "But, and this" => "This" |
00:54:31 | FromDiscord | <ElegantBeef> Yes `func name(yourVar: YourType)` |
00:54:54 | FromDiscord | <ElegantBeef> without `var` you can pass both immutable and mutable variables there |
00:54:59 | FromDiscord | <ElegantBeef> Just cannot mutate them |
00:55:11 | FromDiscord | <checkersai> Well that's no longer a reference, that's just a copy |
00:55:20 | FromDiscord | <ElegantBeef> Depends on teh size |
00:55:23 | FromDiscord | <ElegantBeef> (edit) "teh" => "the" |
00:55:29 | FromDiscord | <ElegantBeef> But eitherway that's not really an issue |
00:55:40 | FromDiscord | <checkersai> yeah |
00:58:49 | * | rockcavera quit (Remote host closed the connection) |
00:59:01 | FromDiscord | <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:48 | FromDiscord | <checkersai> I was basically wondering if there was an equivalent of, like, passing a `const T` |
01:02:07 | FromDiscord | <checkersai> (edit) "T`" => "T`" |
01:02:13 | FromDiscord | <ElegantBeef> That's an immutable pointer? |
01:02:56 | FromDiscord | <checkersai> In C/C++ yeah. I think immutable is too strong a word though and I wrote that poorly |
01:03:53 | FromDiscord | <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:07 | ForumUpdaterBot | New 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:01 | giaco | I 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:46 | giaco | if 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:18 | leorize[m] | saem: ^ |
03:27:06 | saem | giaco: IIRC you set the "nim.project" setting in `.vscode/settings.json` for that code base? |
03:39:53 | FromDiscord | <flywind> Now Nim compiles faster on this benchmark https://github.com/nordlow/compiler-benchmark |
03:40:10 | FromDiscord | <flywind> after applying some strategies. |
03:42:01 | saem | Some strategies? |
03:42:56 | FromDiscord | <ElegantBeef> They said "Compile it faster or i'll unplug your PSU" |
03:43:03 | FromDiscord | <ElegantBeef> Makes the computer go into overdrive |
03:43:09 | FromDiscord | <flywind> turn off stacktrace and checks |
03:43:11 | FromDiscord | <flywind> https://github.com/nordlow/compiler-benchmark/pull/11 |
03:46:09 | saem | Sadly, I doubt those are flags that most people would opt for in most cases. |
03:47:53 | FromDiscord | <flywind> well, disabling it just for this toy benchmark, because the benchmark is so simple to cover the real world example. |
03:48:11 | FromDiscord | <flywind> (edit) "so" => "too" |
03:54:01 | FromDiscord | <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:22 | FromDiscord | <Rika> yeah i think the stacktrace and checks off version is kinda misleading |
03:54:23 | FromDiscord | <flywind> Or profile compiler |
03:54:41 | FromDiscord | <ElegantBeef> Yall dont just `-d:danger` everything? |
03:55:37 | * | spiderstew_ quit (Ping timeout: 252 seconds) |
03:56:18 | FromDiscord | <ElegantBeef> I dont even get what that benchmark is doing 😄 |
04:01:59 | FromDiscord | <flywind> https://media.discordapp.net/attachments/371759389889003532/836089702481264680/unknown.png |
04:02:06 | FromDiscord | <flywind> is it a regression? |
04:02:29 | FromDiscord | <flywind> may be related to https://github.com/nim-lang/Nim/pull/17730 |
04:02:34 | FromDiscord | <flywind> I guess |
04:03:28 | FromDiscord | <ElegantBeef> Probably |
04:08:59 | FromDiscord | <Rika> plugin should deal with it then |
04:09:17 | FromDiscord | <ElegantBeef> Quick throw saem under the bus and run as the bus goes "ka-thonk" |
04:12:51 | FromDiscord | <flywind> well same result with saem's plugin |
04:13:20 | FromDiscord | <flywind> https://media.discordapp.net/attachments/371759389889003532/836092557799981116/unknown.png |
04:16:17 | saem | the plugin can only do so much. cross platform process control is ... sketchy |
04:16:42 | FromDiscord | <flywind> ? |
04:16:59 | FromDiscord | <flywind> this happen with devel and works with stable release |
04:17:18 | FromDiscord | <flywind> may/should be caused by https://github.com/nim-lang/Nim/pull/17730 |
04:17:22 | saem | Sorry, I'm replying to an earlier message, so it's a bit disjoin. |
04:17:30 | FromDiscord | <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:30 | FromDiscord | <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:50 | saem | Hmm, 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:29 | ForumUpdaterBot | New 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:35 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> Seems comical considering how many tests pass, so clearly edge case 😄 |
06:17:11 | * | Vladar joined #nim |
06:17:48 | saem | @ElegantBeef: yup that's a thing or throwing asserts in there. |
06:18:03 | saem | I'm working on something that would potentially help in that scenario. |
06:18:45 | saem | not going to lie, it's a ways off but you might be interested. |
06:28:36 | FromDiscord | <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:17 | Clonkk[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:16 | Clonkk[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:57 | PMunch | Oh damn, I've never had it completely freeze my computer before |
08:50:17 | FromDiscord | <whisperdev> Is it possible to install older version of pkg via nimble? |
08:50:31 | PMunch | Should be, yeah |
08:50:37 | PMunch | Can't remember the syntax though |
08:52:43 | FromDiscord | <whisperdev> pkg@version |
08:52:43 | FromDiscord | <whisperdev> thx |
08:57:52 | PMunch | Haha, you're welcome. Not that I really did much :P |
09:03:48 | FromDiscord | <whisperdev> I think nimble sucks 😐 |
09:04:29 | FromDiscord | <impbox [ftsf]> constructive |
09:23:08 | * | giaco quit (Ping timeout: 265 seconds) |
09:26:00 | FromDiscord | <Rika> Why does it such |
09:26:02 | FromDiscord | <Rika> Suck |
09:26:39 | ForumUpdaterBot | New 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:14 | FromDiscord | <impbox [ftsf]> weird place to post it |
09:43:40 | FromDiscord | <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:25 | FromDiscord | <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:04 | FromDiscord | <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:04 | giaco | it there a way to list unused code in project when compiling? |
11:50:40 | FromDiscord | <zetashift> You should get automatic warnings if code declared is not used |
11:53:24 | FromDiscord | <flywind> see https://github.com/jyapayne/mort |
11:56:49 | FromDiscord | <flywind> see also https://github.com/timotheecour/Nim/issues/245 |
11:57:11 | FromDiscord | <flywind> and upvote this PR https://github.com/nim-lang/Nim/pull/15827 if you want better test coverage support |
12:10:47 | FromDiscord | <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:55 | PMunch | There 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:45 | dsrw | @jtiai The Nim IntelliJ plugin has a lot of promise. I do all of my Nim coding with it these days. |
12:29:04 | dsrw | It's still really young though, so there are definitely rough edges and missing features. |
12:29:45 | FromDiscord | <jtiai> Hmm... I think I have IDEA ultimate... |
12:34:21 | dsrw | @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:12 | dsrw | I 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:01 | dsrw | You 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:39 | FromDiscord | <jtiai> Have to check. I just had a license for ultimate... I just have a clue why. |
12:46:39 | ForumUpdaterBot | New thread by Drkameleon: Error when building for JS - internal error, see https://forum.nim-lang.org/t/7859 |
12:46:49 | dsrw | Ok. 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:22 | FromDiscord | <jtiai> I have pycharm pro as well due dayjob. 🙂 |
12:51:44 | stefantalpalaru | Is 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:51 | FromDiscord | <Rika> all strings are GCable are they not? |
12:54:24 | FromDiscord | <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:55 | FromDiscord | <Zachary Carter> yeah that's correct because it's an unmanaged reference |
12:55:57 | FromDiscord | <Zachary Carter> or pointer |
12:59:47 | stefantalpalaru | I mean: var cstr: cstring; var str = "foo"; cstr = str; # now str is garbage-collected even if I hold on to cstr? |
13:01:49 | leorize[m] | yes, it is garbage collected the moment you drop str (a bit more complicated than that with arc though) |
13:01:50 | leorize[m] | cstring "conversion" is actually dangerous |
13:02:04 | stefantalpalaru | Now you tell me :-) |
13:02:08 | PMunch | Wait, really? |
13:02:28 | PMunch | I mean it makes sense, but I never even considered that |
13:03:05 | leorize[m] | with arc then str is only collected after the containing block went out of scope |
13:03:35 | leorize[m] | and there are some very weird definition of what constitutes a collectible block :p |
13:03:44 | stefantalpalaru | I'm using teh default GC and I was expecting pointers to be absolute GC-blockers due to stack scanning. |
13:04:00 | stefantalpalaru | (And heap scanning) |
13:04:38 | leorize[m] | the inner buffer is not really tracked, I believe the GC only keep tabs of the outer object |
13:04:59 | stefantalpalaru | But it's right at the start of the string object. |
13:05:12 | stefantalpalaru | So the cstring pointer is the same as a string pointer. |
13:05:22 | leorize[m] | well cstring conversion doesn't increase the ref count |
13:06:00 | leorize[m] | deterred ref counting still makes decisions based on the reference count afaik |
13:06:40 | stefantalpalaru | But ref counting in the default, tracing GC, is just an extra feature, not the main mechanism. |
13:06:54 | leorize[m] | you should adopt a better resource management scheme anyway, since orc is gonna be the future |
13:07:40 | leorize[m] | though I'm not quite sure that the collected ptr is the beginning of the string buffer |
13:07:42 | stefantalpalaru | Or maybe there's a header before the buffer in the string object. |
13:07:53 | leorize[m] | we do have length and capacity encoded too |
13:08:28 | stefantalpalaru | I can get the buffer pointer with "addr(str[0])" but that's just a Nim trick. |
13:08:42 | stefantalpalaru | Says nothing about where that is inside the string object. |
13:09:03 | leorize[m] | the string object is opaque, unfortunately |
13:09:28 | leorize[m] | you can read it's implementation in gc.nim iirc |
13:12:42 | ForumUpdaterBot | New thread by Dabod: How to create const object of non-root object type, see https://forum.nim-lang.org/t/7860 |
13:14:18 | stefantalpalaru | Here it is: https://github.com/nim-lang/Nim/blob/e70044fb280909a2da15dc763c9c549a4857632f/lib/system.nim#L532 |
13:14:52 | stefantalpalaru | Strings are sequences with an extra "data" field for the cstring buffer. |
13:22:43 | ForumUpdaterBot | New 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:37 | FromDiscord | <dom96> Any use of addr or ptr is dangerous in Nim. Everyone should be aware of this. |
13:58:55 | PMunch | cstring 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:24 | Clonkk[m] | Anything involving should be considered dangerous |
14:04:34 | Clonkk[m] | * Anything involving C directly should be considered dangerous |
14:25:32 | * | Northstrider[m] quit (Quit: Bridge terminating on SIGTERM) |
14:26:51 | ForumUpdaterBot | New 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:02 | FromDiscord | <mlokis> is there some idiomatic way to get first element of `set[T]` |
14:41:40 | FromDiscord | <Rika> there is no such thing as a "first element" when a set is unordered, i would argue |
14:44:19 | FromDiscord | <mlokis> there is one element in the set and i want to read it |
14:46:29 | FromDiscord | <mlokis> i just need to know what that last element is without doing contains calls |
14:46:39 | FromDiscord | <mlokis> (edit) "what" => "what`s" |
14:48:11 | FromDiscord | <mlokis> (edit) "element is" => "element," |
14:48:18 | * | PMunch quit (Quit: leaving) |
14:54:54 | ForumUpdaterBot | New thread by Miran: NimConf 2021, see https://forum.nim-lang.org/t/7863 |
14:55:26 | FromDiscord | <mlokis> oh i just have to convert it to seq |
16:12:00 | FromDiscord | <Hi02Hi> yes nimconf is back! |
16:12:36 | * | grimler32 joined #nim |
16:15:14 | grimler32 | any universe editors with access to the 4 bit 3 dimensional god code at the multiverse level? |
16:15:30 | * | superbia joined #nim |
16:19:58 | FromDiscord | <Hi02Hi> if a function never uses result, does nim realize this and never initialize it? |
16:27:17 | giaco | Im getting this warning from times.nim: "'parse' cannot raise 'Defect' [XCannotRaiseY]" |
16:27:19 | FromDiscord | <garett> Is there a Nim equivalent of C++ nullptr_t? |
16:29:15 | FromDiscord | <haxscramper> `typeof(nil)` |
16:30:19 | FromDiscord | <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:41 | FromDiscord | <garett> Thanks |
16:31:35 | Clonkk[m] | You can also import nullptr_t in Nim directly if you target C++ backend, if your goal is C++ interop |
16:33:12 | FromDiscord | <garett> I was trying to write `==` to compare an Id type to `nil` |
16:34:49 | * | vicfred joined #nim |
16:36:15 | FromDiscord | <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:48 | FromGitter | <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:05 | FromDiscord | <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:47 | reversem3 | Newbie question: When would you want to create a new operator? |
17:24:28 | reversem3 | meaning creating a new character `+` `-` `*` etc.... |
17:25:04 | FromDiscord | <haxscramper> ``proc`+`(a, b: string): string = a & b`` |
17:25:26 | FromDiscord | <haxscramper> Just put procedure name in the backticks https://nim-lang.org/docs/manual.html#lexical-analysis-operators |
17:25:45 | reversem3 | for what though ? just to make it faster ? |
17:25:46 | FromDiscord | <treeform> sent a code paste, see https://paste.rs/lM3 |
17:26:11 | FromDiscord | <haxscramper> For making it easier to write domain-specific code without having `multiply` vs `` |
17:26:26 | FromDiscord | <haxscramper> E.g. matrix mulitiplication |
17:26:35 | reversem3 | ok thats what I though , so really only in metaprogramming |
17:26:39 | FromDiscord | <haxscramper> no |
17:26:54 | reversem3 | * ok thats what I thought, so really only in metaprogramming |
17:27:02 | FromDiscord | <haxscramper> `[]` is a custom operator, but you create it each time you write container-like types |
17:27:07 | FromDiscord | <treeform> I mostly implement `+` `-` `` when I have my own mathy-number types like vectors, matrices, fixpoint numbers etc... |
17:27:31 | FromDiscord | <haxscramper> `$` is the most common operator |
17:27:52 | reversem3 | yeah I see it a lot in code |
17:27:53 | FromDiscord | <haxscramper> most common custom operator that you might want to reimplement |
17:28:08 | FromDiscord | <treeform> In reply to @ElegantBeef "*still have to clean": Really that's nice. I would like to see it working! |
17:28:51 | reversem3 | ok thanks I have a better understanding now |
17:31:04 | * | tane joined #nim |
17:31:54 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3cAU |
17:32:14 | FromDiscord | <haxscramper> someone certainly had a lot of fun coming up with these operator names like `+++` |
17:40:05 | reversem3 | <FromDiscord "<haxscramper> sent a code paste,"> Empty ? |
17:41:57 | FromDiscord | <haxscramper> I omitted some not boring ones like `&&`. Full list is https://play.nim-lang.org/#ix=3cCr |
17:43:15 | reversem3 | damn |
18:23:42 | * | blackpawn quit (Ping timeout: 268 seconds) |
18:37:37 | * | superbia quit (Quit: WeeChat 3.1) |
18:47:14 | reversem3 | getting 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:45 | reversem3 | Ok 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:16 | FromDiscord | <exelotl> `echo` doesn't return anything, it's just a proc that prints text followed by a newline |
18:59:09 | reversem3 | So why can't you echo the first proc ? |
18:59:48 | FromDiscord | <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:54 | FromDiscord | <exelotl> so x has the value "" |
19:00:12 | FromDiscord | <exelotl> and your `echo x` just prints an extra newline |
19:01:12 | reversem3 | The first one does compile though |
19:02:26 | FromDiscord | <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:59 | reversem3 | even though when I run it on commandline with nim c it returns |
19:04:22 | reversem3 | Hint: 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:22 | reversem3 | Hint: /User/.env/nim/nim_in_action/echo_language [Exec] |
19:04:22 | reversem3 | Nim is the best language! |
19:04:56 | reversem3 | I'm not trolling I'm just curious , I get no return type |
19:05:32 | FromDiscord | <exelotl> > even though when I run it on commandline with nim c it returns "Nim is the best language!" |
19:05:38 | FromDiscord | <exelotl> this is not exactly true |
19:05:45 | FromDiscord | <d4rckh> is this the right channel to get help with some issues coding in nim? |
19:06:15 | FromDiscord | <exelotl> it outputs "Nim is the best language!" but it doesn't return it |
19:06:53 | FromDiscord | <d4rckh> im trying to make a little web fuzzer in nim but i have a little problem with |
19:07:13 | FromDiscord | <exelotl> @d4rckh yep! |
19:08:04 | reversem3 | ok thanks @exelotl |
19:08:16 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/TMT |
19:09:32 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/Qfl |
19:09:34 | FromDiscord | <d4rckh> actually heres more code |
19:09:45 | FromDiscord | <d4rckh> (edit) "https://paste.rs/qtq" => "https://paste.rs/YYu" |
19:10:27 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3cQv" => "https://paste.rs/4Bk" |
19:10:53 | FromDiscord | <haxscramper> The problem is missing text before 2001? Try `echo words` to see if the sequence contains all strings as you expect |
19:11:54 | FromDiscord | <d4rckh> oh, theres a weird control character `\c`, i assume it means end of text or something? |
19:12:29 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3cQN |
19:12:51 | FromDiscord | <haxscramper> Yes, `split("\n")` is not really suitable for line separation, instead you should do `for word in lines(inputFile)` |
19:13:18 | FromDiscord | <haxscramper> `lines` is an iterator so it must be used in the `for` loop, but it accounts for windows-specific line separators |
19:13:23 | FromDiscord | <d4rckh> and inputFile is open(path) instead of readFile(path) ? |
19:14:18 | FromDiscord | <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:34 | FromDiscord | <haxscramper> I missed that you had file reading at the very top, sorry |
19:14:58 | FromDiscord | <d4rckh> ah ok |
19:14:59 | FromDiscord | <exelotl> reversem3: https://play.nim-lang.org/#ix=3cRc |
19:15:07 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3cRg |
19:15:14 | FromDiscord | <d4rckh> thank you |
19:15:17 | FromDiscord | <d4rckh> thats useful 😛 |
19:26:59 | FromDiscord | <d4rckh> @haxscramper how would i go about splitting a string without having these characters inserted? |
19:28:38 | reversem3 | <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:45 | FromDiscord | <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:25 | reversem3 | <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:30 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/oZH |
19:29:36 | FromDiscord | <d4rckh> but when i do it, i get a `\c` at the beginning |
19:32:39 | FromDiscord | <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:28 | FromDiscord | <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:51 | FromDiscord | <d4rckh> right |
19:40:36 | FromDiscord | <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:10 | FromDiscord | <exelotl> for example, `writeFile` is a procedure that saves some text to a file |
19:41:19 | FromDiscord | <exelotl> it doesn't make sense for it to return a value |
19:42:35 | * | abm joined #nim |
19:44:11 | reversem3 | @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:05 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3d8R |
21:04:22 | FromDiscord | <haxscramper> And how I can make all constant symbols to be passed as symbols? |
21:06:12 | FromDiscord | <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:21 | leorize[m] | typed ast is not spec-ed unfortunately |
21:06:46 | FromDiscord | <haxscramper> Which means "good luck handling edge cases"? |
21:07:03 | leorize[m] | good luck using it at all |
21:07:53 | leorize[m] | the cps effort might bring some more consistency to typed ast but we also have to walkaround compiler bugs |
21:08:37 | FromDiscord | <ElegantBeef> Not overly lovely but you can use dynamicbindsym |
21:08:39 | FromDiscord | <haxscramper> Thankfully I've avoided most of the issues with typed ast, but that `const` one got me in the end |
21:08:44 | FromDiscord | <ElegantBeef> then just pass in them as untyped |
21:09:08 | FromDiscord | <ElegantBeef> Though afaik that requires you to then include the module with this macro so it can bind in the properscope |
21:10:21 | FromDiscord | <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:33 | FromDiscord | <haxscramper> typed AST |
21:10:41 | FromDiscord | <haxscramper> (edit) "untyped" => "typed" |
21:14:35 | FromDiscord | <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:58 | FromDiscord | <haxscramper> And maybe other RFCs, but they don't exactly cover all use cases |
21:15:14 | leorize[m] | yea, we don't have much standardization in this area |
21:15:20 | FromDiscord | <haxscramper> Like enum turning into `IntLit` in branch fields |
21:15:25 | leorize[m] | cps is currently the biggest user of typed macros |
21:15:36 | * | rockcavera joined #nim |
21:15:56 | leorize[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:46 | FromDiscord | <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:23 | FromDiscord | <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:13 | leorize[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:10 | FromDiscord | <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:20 | FromDiscord | <haxscramper> Via multi-stage macro |
21:47:24 | FromDiscord | <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:01 | leorize[m] | it's not niche |
21:50:02 | leorize[m] | typed ast is the only way to reliably compose macros |
21:51:27 | FromDiscord | <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:25 | FromDiscord | <haxscramper> Especially when building complex macros |
21:55:27 | leorize[m] | they are not edge cases if there are tons of them, right? |
21:55:33 | leorize[m] | we lack a formal spec to deal with special nodes within the typed ast structure |
21:55:35 | leorize[m] | nnkHidden* family of nodes come to mind |
21:57:04 | FromDiscord | <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:03 | FromDiscord | <haxscramper> well, I should probably say "inconsistent behavior" rather than "edge case" |
22:04:58 | FromDiscord | <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:12 | FromDiscord | <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:33 | FromDiscord | <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:25 | FromDiscord | <retkid> nim is like 98% the speed of C right |
22:15:19 | FromDiscord | <Recruit_main707> basically, give or take depending on the usecase |
22:15:27 | FromDiscord | <ElegantBeef> Yea purely depends on usecase/code |
22:15:51 | FromDiscord | <haxscramper> You can get over 100% for speed sometimes due to compiler optimizations |
22:16:09 | FromDiscord | <ElegantBeef> Yea there is no one definitive percentage |
22:16:09 | FromDiscord | <haxscramper> I think I've seen it a couple of times |
22:16:27 | FromDiscord | <ElegantBeef> Nim can be fast if written write and you actually build `-d:release` |
22:16:33 | FromDiscord | <ElegantBeef> (edit) "write" => "right" |
22:16:43 | FromDiscord | <retkid> yea so its IN an around the speed of C |
22:16:48 | FromDiscord | <retkid> (edit) "an" => "and" |
22:16:50 | FromDiscord | <ElegantBeef> Sure |
22:16:52 | FromDiscord | <retkid> if you write the code rightg |
22:16:53 | FromDiscord | <retkid> (edit) "rightg" => "rightt" |
22:18:31 | FromDiscord | <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:51 | FromDiscord | <ElegantBeef> term rewritting protections when? 😛 |
22:19:16 | FromDiscord | <haxscramper> 9k macro instantiations |
22:22:15 | FromDiscord | <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:21 | FromDiscord | <retkid> i did 13 needless re operation |
22:22:26 | FromDiscord | <retkid> and read from a file 14 needless times |
22:22:36 | FromDiscord | <retkid> (edit) "4" => "4-8" |
22:23:06 | FromDiscord | <retkid> (edit) "optimize" => "fix, it" | "4-8" => "like 8" | "write" => "complete operation" |
22:23:12 | FromDiscord | <ElegantBeef> It's like people that use `split` and only read from the string |
22:23:40 | FromDiscord | <retkid> they never save the partition or the spli |
22:23:40 | FromDiscord | <ElegantBeef> maybe just make a proc that takes a string and a start/end 😄 |
22:23:41 | FromDiscord | <retkid> (edit) "spli" => "split" |
22:23:43 | FromDiscord | <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:25 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3duM |
23:18:13 | FromDiscord | <exelotl> guess I'd have to use a template instead of an iterator |
23:24:25 | * | teal quit (Quit: WeeChat 3.1) |
23:31:21 | FromDiscord | <ElegantBeef> Well you can always use a defer instead, but yea same principle |
23:32:19 | FromDiscord | <exelotl> yeah I'm working under --os:standalone --gc:none so I don't think I can use try..catch |
23:33:21 | FromDiscord | <exelotl> (or defer) |