<< 08-12-2021 >>

00:06:05FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Hju
00:07:13FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3Hju" => "https://play.nim-lang.org/#ix=3Hjv"
00:07:33FromDiscord<retkid> this is strange
00:27:03arkanoidas Rika says, I just stepped on this by accident. I know it's something that has no sense really, but internal error is unexpected anyways
00:33:15FromDiscord<Elegantbeef> It's a simple bug afaict, sem's the expression `sequtils` which is a module so when it attempts to generate it, it errors with the expr generation error
00:33:58FromDiscord<Elegantbeef> Any expression returning a module should almost certainly error
00:35:18FromDiscord<Elegantbeef> error in semantic analysis not in code gen 😀
00:36:45FromDiscord<Rika> you did say sem and not codegen
00:36:51FromDiscord<Rika> who are you correcting
00:36:56arkanoidsure it is a stupid error, but it is. I've just opened the issue
00:37:57FromDiscord<Elegantbeef> well it errors in code gen presently
00:38:01FromDiscord<Elegantbeef> I was just saying where it should error
00:40:42arkanoidI'm not into compiler internals. I need a good book that can introduce me to the parsing world, better if the one use in nim. Actually I'd be really interested in acquiring this skill
00:41:03FromDiscord<Elegantbeef> This is actually unrelated to parsing
00:41:17FromDiscord<Elegantbeef> I spend most my time in semantic analysis, which is basically macros but in the compiler
00:41:44FromDiscord<Elegantbeef> The issue here is that presently `semExpr` doesnt error when `n.kind == skModule` though it should
00:43:03FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/f91867aa31f3ae2c4f28d24547d62603daaa6d0c/compiler/semexprs.nim#L2793-L2810 right here to be accurate
00:43:23FromDiscord<Elegantbeef> Notice there is no checking of `skModule`
00:45:44FromDiscord<Elegantbeef> Though i could be wrong with the idea that modules shouldnt be usable in expressions
00:46:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HjA
00:47:45arkanoidwell, it might be useful for a plugin system
00:48:28FromDiscord<Elegantbeef> Yep which makes this more complicated 😀
00:50:07*src quit (Quit: Leaving)
00:50:12FromDiscord<Elegantbeef> So now we have to look at the flags that `semExpr` has and see if we can use those to reason out of this problem 😀
00:52:09arkanoidwould be interesting hear a gentle introduction to nim compiler internals
00:53:22FromDiscord<Elegantbeef> Well actually that isnt even valid code in the above
00:53:53FromDiscord<Elegantbeef> `/usercode/in.nim(2, 49) Error: in expression 'math.sum': identifier expected, but found 'sum'` Lol
00:55:41FromDiscord<Elegantbeef> I'd say you have 3 phases of compilation. Parsing, semantic analysis, and code generation
00:57:34FromDiscord<Elegantbeef> Parsing is taking the code and turning it into the AST. Semantic analysis is taking that AST and checking it's soundness and generating types, code generation takes that AST then outputs the selected backend's compatible code, changing it as it needs to to fit with the semantics of the selected backend
00:58:43FromDiscord<Elegantbeef> Semantic analysis is the most complex stage as it's really where the language lives
01:01:45NimEventerNew thread by Treeform: Show Nim: Forematics is a Metamath verifier written in Nim., see https://forum.nim-lang.org/t/8691
01:02:15arkanoiddoes Nim have an advantage over other languages?
01:02:35arkanoidI mean, talking about compiler structure
01:02:53FromDiscord<Elegantbeef> Well it's self hosted unlike to Zig/Odin
01:03:00FromDiscord<Elegantbeef> Zig uses a packed AST which is faster
01:03:23FromDiscord<Elegantbeef> Nim uses a reference based AST which is slower for obvious reasons but is easier to directly reason about
01:05:07arkanoidis it a parsing advantage or we're into semantic analysis step?
01:05:31FromDiscord<Elegantbeef> The performance advantage is in cache locality for the repetitive looping in semantic analysis/code gen
01:05:44FromDiscord<Elegantbeef> Cause that's all the compiler really is, a tree of data it loops over and reasons on
01:05:58FromDiscord<Elegantbeef> Take a look at `var a = 300`
01:06:39FromDiscord<Elegantbeef> It's a simple thing, but the way the compiler sees it is `varsection -> identdefs -> (a: nkEmpty = nkIntLit(300))`
01:07:38FromDiscord<Elegantbeef> So it first says "Sem this varsection" which then goes through each ident def and checks "Ok so we have type nkEmpty and an nkIntLit, does this fit, yes? Ok so we can type this to nkInt instead of nkEmpty"
01:07:48FromDiscord<Elegantbeef> well i guess it'd be `tyInt` in reality
01:09:02FromDiscord<Elegantbeef> After seming that we now have a symbol `a` of type `tyInt`, so in any other statements that come after we will find this symbol and know it's type when we do `a`
01:09:58FromDiscord<Elegantbeef> That pretty much is all the compiler does in semantic analysis
01:10:12FromDiscord<Elegantbeef> Hopefully i explained it well enough
01:11:22*vicfred quit (Quit: Leaving)
01:11:28FromDiscord<Elegantbeef> Feel free to ask if you have any questions, i'm not the best compiler dev but i know how stuff works 😛
01:12:59FromDiscord<Elegantbeef> Personally i've never read anything about compiler development i've just looked at small bugs like this one and face to grindstone until i reasoned why/how to fix it
01:13:10FromDiscord<Elegantbeef> So if you want to touch the compiler i'd suggest the same
01:13:28FromDiscord<Elegantbeef> Look for simple bugs and find why they dont work and soon you'll be a better compiler dev than I 🙂
01:15:01arkanoidyou've my gratitude for this intro and for the confidence booster pill
01:16:03FromDiscord<Elegantbeef> Given what i've told you you probably can make a PR to the compiler for fixing this module issue
01:16:43FromDiscord<Elegantbeef> You have the exact line number and a flag for when the error should be emitted, so just need to emit the error and make some tests
01:18:10FromDiscord<Elegantbeef> One of the harder things is thinking of examples on where this might break or what might break
01:18:27FromDiscord<Elegantbeef> You want tests that properly attempt to break the code not just tests that show it working
01:20:14FromDiscord<Elegantbeef> It is a shame there arent more people with knowledge of the Nim compiler actively talking about compiler developing encouraging others though
01:21:38arkanoidyes, but it feels something hard to grasp
01:22:02FromDiscord<Elegantbeef> It first seems that way, but if you're in semantic analysis, it's just slightly lower level macros
01:22:32FromDiscord<Elegantbeef> Like that was the big thing that i needed to understand to really understand to reason how to work with the compiler
01:31:32arkanoida visualization like this? :P https://cscircles.cemc.uwaterloo.ca/visualize#mode=display
01:32:16FromDiscord<Elegantbeef> I do not know
01:32:27FromDiscord<Professor Actual Factual> Does anyone know if the std/deques implementation is threadsafe? Im looking into the source code and to me it does not look like it is https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/collections/deques.nim#L369
01:32:35FromDiscord<Elegantbeef> Ah actually certainly not like that
01:32:40FromDiscord<Elegantbeef> That's showing a running program
01:33:08FromDiscord<Elegantbeef> I guess it's like the Global frame alone
01:33:22FromDiscord<Elegantbeef> Where it looks at the global symbols and says "These exist and take X"
02:37:03nrds<Prestige99> Has anyone used coz-profiler, or has anyone tried using it with Nim? It looks interesting
02:50:13*bigmanbird joined #nim
02:50:21bigmanbirdany word on the progress of this PR https://github.com/nim-lang/Nim/pull/16356 ?
02:51:02FromDiscord<Elegantbeef> Uhh i'm a dumb dumb that doesnt like what i've done
02:52:26bigmanbirdoh, I thought it looked nice
02:54:01nrds<Prestige99> I was also looking forward to it :P
02:55:24FromDiscord<Elegantbeef> Well it's going to just turn into anything inside `'a'` is coloured so not overly useful imo
02:55:42nrds<Prestige99> Agreed
02:56:15FromDiscord<Elegantbeef> Colouring all the errors is tedious and requires something like nkerror to be used fully
02:56:42nrds<Prestige99> nkerror not being used everywhere there's an error thrown?
02:58:02FromDiscord<Elegantbeef> Atleast in my view yes
02:58:50FromDiscord<Rika> i think in general there should be a nicer internal api for errors in the compiler, it just feels like an afterthought
02:59:01FromDiscord<Elegantbeef> I think the nk errors give that
02:59:08FromDiscord<Rika> true
02:59:38FromDiscord<Rika> i assume also that nkerrors can have nodes in them as well
03:00:03FromDiscord<Elegantbeef> In saem's nimskull impl nkerrors hold the AST that erroed
03:00:10FromDiscord<Rika> nice
03:00:25FromDiscord<Rika> and also structured error text should be a part i feel
03:01:01*neurocyte0132889 quit (Ping timeout: 240 seconds)
03:01:10FromDiscord<Elegantbeef> Yep hax is wanting that aswell
03:17:27FromDiscord<Casey.McMahon> anyone with experience with arraymancer know how I can get a list of coordinates of the neigbourhood around a point? like if I choose the point `[1,1]`, get a list like `[[0,0],[0,1],[0,2],[1,0],[1,2],[2,0],[2,1],[2,2]]` ?
03:28:49*arkurious quit (Quit: Leaving)
03:39:21*tiorock joined #nim
03:39:21*tiorock quit (Changing host)
03:39:21*tiorock joined #nim
03:39:21*rockcavera is now known as Guest3185
03:39:21*tiorock is now known as rockcavera
03:42:13*Guest3185 quit (Ping timeout: 240 seconds)
03:44:14*bigmanbird quit (Read error: Connection reset by peer)
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:35:47*xet7 quit (Remote host closed the connection)
04:36:49*xet7 joined #nim
05:04:41*u0_a185 joined #nim
05:54:34FromDiscord<haxscramper> https://github.com/nim-works/nimskull/pull/94↵(@Rika)
05:56:16FromDiscord<Rika> Maybe I should pull the trigger and start looking deeper
05:56:22FromDiscord<haxscramper> I doubt main nim ever agrees to a refactor like that, so
05:56:49FromDiscord<haxscramper> Araq thinks error message are good enough, and he probably wouldn't like changes that aggressive
05:57:00FromDiscord<haxscramper> Bit this literally is everywhere
05:57:22FromDiscord<haxscramper> Absolutely every single damn module of the compiler generates ad-hoc copypasta of strings
05:57:57FromDiscord<haxscramper> https://github.com/nim-works/nimskull/discussions/60#discussioncomment-1674521
06:17:40FromDiscord<Sabena Sema> where's the github repo of work on a new os library that had an os string/program string distinction
06:22:31*vicfred joined #nim
06:47:39FromDiscord<haxscramper> The only thing that can qualify as a "new os library" is probably this https://github.com/alaviss/nim-sys
06:47:55FromDiscord<haxscramper> But I'm not sure if it has the distinction you are talking about
06:48:01FromDiscord<leorize> it doesn't
06:48:27FromDiscord<leorize> it only has string/nulless distinction
07:16:25*u0_a185 quit (Read error: Connection reset by peer)
07:16:42*u0_a185 joined #nim
07:28:15FromDiscord<konsumlamm> In reply to @Professor Actual Factual "Does anyone know if": i'm pretty sure none of the stdlib collections are thread-safe (except the ones that have "shared" in their name, but those are all deprecated now)
07:30:01*vicfred quit (Quit: Leaving)
07:30:20*vicecea quit (Read error: Connection reset by peer)
07:30:51*vicecea joined #nim
07:54:47FromDiscord<hieu.nt> guys can i do something like this in nim
07:55:02FromDiscord<hieu.nt> if define MACOS
07:55:08FromDiscord<hieu.nt> import A
07:55:21FromDiscord<hieu.nt> else if define Windows
07:55:23FromDiscord<hieu.nt> import B
07:55:29FromDiscord<leorize> yes you can
07:55:55FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3Hky
08:00:26Amun-Rayou can have your own defines: https://play.nim-lang.org/#ix=3HkB
08:09:07*PMunch joined #nim
08:22:46PMunchDoes nimsuggest support go to definition on modules? Ref. https://github.com/PMunch/nimlsp/issues/102
08:58:39*pro joined #nim
09:13:22*xet7 quit (Quit: Leaving)
09:37:38FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HkS
09:37:39FromDiscord<valerga> for some reason that doesn't work
09:37:50FromDiscord<valerga> "type mismatch: got <void> ... "
09:38:37PMunchYou need else statements I believe
09:39:27PMunchOh never mind
09:56:16*pro quit (Quit: WeeChat 3.3)
09:57:08*pro joined #nim
10:12:52FromDiscord<Sabena Sema> In reply to @haxscramper "The only thing that": thank you, that's what I was looking for
10:13:11FromDiscord<Sabena Sema> also: I note that std/packedsets has a note "Currently the assignment operator = for PackedSet[A] performs some rather meaningless shallow copy. Since Nim currently does not allow the assignment operator to be overloaded, use the assign proc to get a deep copy."
10:13:45FromDiscord<Sabena Sema> it seems like `=copy` exists in nim 1.6, has nobody gotten around to adding support for it in packedset or is it lacking due to not wanting to break code
10:15:01FromDiscord<Rika> Likely the former, since you could just leave the assign proc
10:15:17FromDiscord<Sabena Sema> yeah but it would break anyone relying on the old shallow copy
10:15:25FromDiscord<Sabena Sema> although most of that code is just buggy 😄
10:15:33FromDiscord<Sabena Sema> so really you are probably fixing more bugs than you're creating
10:16:19FromDiscord<Rika> Every bug fix can be considered as a breaking change but there is a limit to sanity
10:16:59FromDiscord<MrOkram> Nimble directory down ? https://media.discordapp.net/attachments/371759389889003532/918083728033607730/unknown.png
10:17:16FromDiscord<Rika> Who was it again who maintained that
10:17:23FromDiscord<Rika> @federico3
10:18:01FromDiscord<Sabena Sema> hmm maybe it's because they are experimental by virtue of being type-bound
10:18:41FromDiscord<Elegantbeef> The type bound operations are not experimental
10:19:28FromDiscord<Sabena Sema> just `=deepCopy`?
10:20:27FromDiscord<Elegantbeef> What do you mean?
10:31:07FromDiscord<Zoom> What's up with nimble.directory? Gives me 502
10:31:47FromDiscord<MrOkram> Looks like it's down
10:46:15NimEventerNew question by Katlyn: Nim: Find index of element in seq based on predicate, see https://stackoverflow.com/questions/70273671/nim-find-index-of-element-in-seq-based-on-predicate
10:46:35FromDiscord<inv> Anyone has laptop with amd 5800u?
10:57:39FromDiscord<valerga> what's the nice way to do:
10:57:47FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3Hla
10:59:22FromDiscord<Rika> Use either zero functional (3rd party) or sequtils (has overhead)
10:59:47FromDiscord<valerga> which sequtils method?
10:59:59FromDiscord<Rika> mapIt
11:00:06FromDiscord<Rika> Ah wait
11:00:07FromDiscord<Solitude> foldl
11:00:08FromDiscord<inv> @valerga foldr(a+a) or import math and sum()
11:00:11FromDiscord<Rika> Yeah map and folds
11:00:46FromDiscord<inv> sent a code paste, see https://play.nim-lang.org/#ix=3Hld
11:00:50FromDiscord<valerga> i thought about those but wouldn't they require an already filled array?
11:00:56FromDiscord<Rika> lines.mapIt(parseInt(calculate(it)).sum or so
11:01:05FromDiscord<Rika> Is lines not a filled array
11:01:19FromDiscord<Solitude> toSeq(lines("1.txt")).foldr(a+b.parseInt, 0)
11:01:29FromDiscord<Rika> In reply to @Solitude "toSeq(lines("1.txt")).foldr(a+b.parseInt, 0)": True
11:01:35FromDiscord<valerga> yeah lines is, I thought about the calculate items
11:01:37FromDiscord<Rika> Do your parse and calculate on b in that case
11:01:45FromDiscord<valerga> i'll try that
11:03:07FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HkS
11:03:09FromDiscord<valerga> also don't know what's missing there
11:03:19FromDiscord<valerga> "missing parameter: body"
11:04:07FromDiscord<Rika> I do not see an issue there
11:04:31FromDiscord<valerga> "Error: type mismatch: got <void>↵but expected one of: ↵macro collect(ini"
11:05:13FromDiscord<valerga> i imported std/sugar
11:05:32FromDiscord<Solitude> can you give selfcontained snippet?
11:05:36FromDiscord<Rika> Yeah I don’t think there’s an issue
11:11:58FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3Hli
11:12:09FromDiscord<valerga> im working on it, just a moment
11:14:46*jjido joined #nim
11:15:15FromDiscord<valerga> ok this weird
11:15:16FromDiscord<valerga> https://play.nim-lang.org/#ix=3Hll
11:15:19FromDiscord<valerga> it works there
11:15:21FromDiscord<valerga> but not locally
11:15:30FromDiscord<valerga> my compiler is 1.4.8
11:16:08FromDiscord<valerga> if you select 1.4.8 in the playground it throws the error
11:18:06FromDiscord<valerga> so I guess i can just update the compiler
11:18:15FromDiscord<valerga> though my distro still has 1.4.8 in the repos
11:41:26*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:42:29PMunchAha, collect on 1.4.8 only had the version with the init and body
11:44:02FromDiscord<valerga> oh, I checked the docs to see how collect worked, I guess it was updated recently
11:44:58FromDiscord<valerga> should have used `collect(newSeq):`
11:57:47NimEventerNew thread by Freeflow: More nim newbie woes, this time echo fmt Possible AOC2021 spoiler, see https://forum.nim-lang.org/t/8692
12:03:45FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3Hlx
12:03:53FromDiscord<valerga> how could I do that, break, but return the previous value?
12:04:06FromDiscord<valerga> add k.intToStr
12:04:49FromDiscord<valerga> in the collect
12:04:55FromDiscord<Rika> So you only want one value?
12:05:03FromDiscord<valerga> no, because there are two fors
12:05:25FromDiscord<Rika> Don’t think it’s possible no
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:32*supakeen joined #nim
12:16:19*jjido joined #nim
12:17:14PMunchUpdated the logo on the Nim subreddit, Snoo now has a crown! https://www.reddit.com/r/nim/
12:25:05FromDiscord<satoro.tadziri> sent a code paste, see https://play.nim-lang.org/#ix=3HlB
12:25:17FromDiscord<satoro.tadziri> (edit) "https://play.nim-lang.org/#ix=3HlB" => "https://play.nim-lang.org/#ix=3HlC"
12:31:39*xet7 joined #nim
12:31:44FromDiscord<narimiran> In reply to @satoro.tadziri "Hi guys I": https://github.com/technicallyagd/unpack
12:31:53FromDiscord<narimiran> (edit) "https://github.com/technicallyagd/unpack" => "https://github.com/technicallyagd/unpack#rest-operator-for-unpacking-sequences"
12:47:42*oddish quit (Quit: nyaa~)
13:01:08FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3HlO
13:16:15FromDiscord<Zoom> Anyone uses supersnappy? It's kinda weird it's API is built around strings. How can I construct a `string` or a `seq[byte]` from raw parts? I have an `openArray`
13:19:50*src joined #nim
13:25:39PMunchDefine raw parts
13:26:26FromDiscord<Zoom> I dunno, seq is magic \:D. Probably, a ptr, a len and capacity.
13:27:34FromDiscord<Zoom> I'm used to `from_raw_parts` in Rust, couldn't find anything like this in std. There constructors for openArrays, but not for seqs
13:31:12PMunchWell seqs are GC'd, which means that the memory they contain must be possible for the GC to free
13:31:44PMunchThis typically means you need to copy data into the seq in order for it to work
13:40:14FromDiscord<Zoom> Well, that's weird to say the least. It means I can't compress without copying the source?
13:40:56FromDiscord<Zoom> @guzba\: could you help with this ☝️
13:42:54FromDiscord<Rika> you can cast string to seq byte """safely"""
13:43:22FromDiscord<Solitude> he has openArray
13:43:30FromDiscord<Zoom> That's irrelevant and actually what supersnappy does for taking seqs (yep, not the other way!)
13:44:09NimEventerNew thread by Archnim: Nim script file extension, see https://forum.nim-lang.org/t/8693
13:58:57*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:00:09*jjido joined #nim
14:00:52*jjido quit (Client Quit)
14:06:14*Schnouki quit (Remote host closed the connection)
14:06:35*Schnouki joined #nim
14:17:49FromDiscord<dom96> PMunch: consider updating it for old.reddit.com as well
14:18:15PMunchI use old reddit and it is updated for me
14:19:33PMunchIn fact it only shows up on old reddit
14:19:47PMunchNew reddit seems to have some styling done to it already
14:19:53FromDiscord<dom96> huh, I don't see it
14:20:01FromDiscord<dom96> maybe I have custom reddit styles disabled
14:20:30FromDiscord<dom96> yeah, I do
14:20:40FromDiscord<dom96> looks good! Very subtle
14:21:10PMunchThanks, that was the goal :)
14:22:04FromDiscord<valerga> i only use old.reddit
14:57:04*oddish joined #nim
15:01:35*PMunch quit (Quit: Leaving)
15:13:31*pro quit (Quit: WeeChat 3.3)
15:54:23FromDiscord<ni-max> Hey Nim's forum Mods will you please verify my account (`nimax`)
16:00:34FromDiscord<Vindaar> @ni-max you should be good now
16:00:35NimEventerNew thread by Archnim: Improve forum, see https://forum.nim-lang.org/t/8694
16:19:10FromDiscord<Professor Actual Factual> Currently writing my own allocaters and deallocators for a ptr object, is there a way to check memory safety at compile time?
16:23:07FromDiscord<dom96> nope, `ptr` is inherently unsafe
16:29:15FromDiscord<Vindaar> In reply to @dom96 "nope, `ptr` is inherently": well, it's more complicated than that:↵- if you use are willing to wrap the `ptr` thing in an object, you can clean up automatically using `=destroy`↵- you could maybe wrap it in some dummy object that makes use of some `static int` to track certain usages, but that will probably result in not-so-nice to write code in general↵and there's probably other things I'm not thinking of
16:35:58FromDiscord<Pralkarz> Is there sequence unpacking similar to Python in Nim?
16:39:33FromDiscord<Vindaar> sent a code paste, see https://play.nim-lang.org/#ix=3Hnl
16:46:54*arkurious joined #nim
16:47:23FromDiscord<Professor Actual Factual> Oh i know these things are unsafe, and obviously i dont expect GC.↵I was just wondering if there was a compile flag or something that would spit out warnings about detecting ptr objects that are not deallocated. Just a sanity check really.
16:49:56FromDiscord<Professor Actual Factual> In reply to @Pralkarz "Is there sequence unpacking": Sequences or arrays cant be unpacked in nim. Try looking into varargs to see if they fit your needs
16:50:19FromDiscord<Pralkarz> Will do, thanks!
16:53:46*PMunch joined #nim
16:54:36FromDiscord<Xzight> Hi so I am trying out Nim today and following the "Nim Basics" tutorial but I'm running into a problem. My terminal is telling me `The term 'nim' is not recognized` but I have double checked and it is in my Windows PATH and I also restarted my PC. Anyone else ran into this or have any ideas to fix it?
16:56:01FromDiscord<Xzight> It only works if I open Powershell as Administrator but its in my user PATH so I'm confused.
16:57:21FromDiscord<sdmcallister> How did you install Nim?
16:58:05FromDiscord<Xzight> I downloaded the zip and ran the `finish.exe` file
17:00:59FromDiscord<sdmcallister> Assuming 1.6
17:01:20FromDiscord<Xzight> Yes
17:01:58FromDiscord<Xzight> VSC is also saying this https://media.discordapp.net/attachments/371759389889003532/918185643086053466/unknown.png
17:02:53FromDiscord<Xzight> This is in my PATH though https://media.discordapp.net/attachments/371759389889003532/918185875551174696/unknown.png
17:03:42FromDiscord<el__maco> do you see that if you open cmd.exe and say "path"
17:04:46FromDiscord<Xzight> no it's not there...
17:04:58FromDiscord<el__maco> then maybe its not in the path
17:05:27FromDiscord<Xzight> weird because the `finish` program is telling me it is...I think i'm going to try restarting again idk what else to do haha
17:05:39FromDiscord<Xzight> or maybe I will just use powershell as administrator since its working that way
17:05:41FromDiscord<sdmcallister> https://media.discordapp.net/attachments/371759389889003532/918186581012123668/unknown.png
17:06:17FromDiscord<Xzight> The yellow `Path` is the one I was clicked on for my screenshot
17:07:07FromDiscord<el__maco> you should have multiple paths in there 🤔
17:07:26FromDiscord<Xzight> yeah I do I just didnt show the full thing because it has my name in it lol
17:07:55FromDiscord<Xzight> i have these there as well https://media.discordapp.net/attachments/371759389889003532/918187142562328656/unknown.png
17:09:37FromDiscord<sdmcallister> does it work in cmd.exe as admin?
17:10:52FromDiscord<Xzight> yeah I just tried it and I typed `path` as admin and it showed up
17:10:54FromDiscord<Xzight> so weird
17:12:15FromDiscord<el__maco> there's two panels in the environment variable dialog, you have "user variables" and "system variables". Both have "path" in them
17:12:31FromDiscord<Xzight> I'm looking at user
17:12:35FromDiscord<Xzight> Does it need to be in system instead?
17:12:44FromDiscord<el__maco> I think user should work
17:13:07FromDiscord<el__maco> ofc you could try the other one too
17:13:29FromDiscord<el__maco> maybe you have some weird permission thing going, though I don't know what that might be
17:14:20FromDiscord<sdmcallister> If your pc is a corporate one I could see that. I have some weird issues to from time to time
17:14:29FromDiscord<dom96> In reply to @Vindaar "well, it's more complicated": Those are ways that you can make `ptr` safer, but it doesn't change the fact that any use of `ptr` should be looked at with suspicion. Similar to how `unsafe` blocks are in Rust
17:14:56FromDiscord<dom96> Same for `addr` and `cast` and (probably a few others)
17:15:07PMunchAdvent of Code, day 8 streaming live right now: https://www.twitch.tv/pmunche
17:16:00FromDiscord<Xzight> I guess it took 2 restarts lol problem solved though 😄
17:16:34FromDiscord<Xzight> maybe its becaue my PC did some updates the first time so it didn't go through
17:16:45FromDiscord<Xzight> (edit) "becaue" => "because"
17:16:48FromDiscord<$(Scott)> Is there a plugin for Nim's syntax & LSP written in lua for neovim?
17:17:05FromDiscord<$(Scott)> (edit) "Is there a plugin for Nim's syntax ... &" added "hl"
17:17:58FromDiscord<Vindaar> In reply to @dom96 "Those are ways that": but that's a reductive way of looking at the problem. Every garbage collector uses something like alloc / dealloc under the hood. Does that mean the GC is unsafe? Of course not. So as long as you can build a thin abstraction around `ptr` you might be able to build something CT safe on top of it. One doesn't use raw `ptr` for fun after all
17:32:16FromDiscord<dom96> In reply to @Vindaar "but that's a reductive": No, it doesn't mean the GC is unsafe. It means its code can be considered "unsafe" though and as such should be audited carefully.
17:34:50FromDiscord<Vindaar> but that's a statement that's orthogonal to what @Professor Actual Factual asked
17:38:14FromDiscord<dom96> I interpreted it as "is there any way to check whether a `ptr` is safe at compile-time?"
17:38:28FromDiscord<dom96> To that I don't think my statement was orthogonal 🙂
17:39:58FromDiscord<Vindaar> No, your initial statement wasn't. But it was too strict, because depending on the constraints you can build something around `ptr` that provides the benefits, but gives you CT safety. Of course, the code that implements this will fall under the category you mention, but that's not a useful piece of information if the end result gives you the opposite answer to what you said
17:43:23FromDiscord<dom96> Okay, well I guess we are misunderstanding each other a bit:↵↵ I thought you were disagreeing with me on `ptr` being inherently unsafe↵ You think that I am disagreeing with you that `ptr` can be wrapped to be made safe
17:44:05arkanoidPMunch: I've just found out 2 things: only the nim based vscode extension is not reading the .cache/nil folder, the javascript based does (https://github.com/saem/vscode-nim/issues/65). Second: I've found out the compiling two times solves the posix symbol issue (I've updated the issue)
17:44:13FromDiscord<dom96> If @Professor Actual Factual is looking for a way to wrap their use of `ptr` in an API that is safe then definitely your advice is welcome
17:45:26FromDiscord<Professor Actual Factual> I just want a flag or warning that pops up when im compiling that says hey you forgot to deallocate this object to avoid shooting myself in the foot. Lol sorry for the confusion
17:46:26FromDiscord<Vindaar> In reply to @dom96 "Okay, well I guess": yeah, I suppose
17:46:53FromDiscord<Vindaar> In reply to @Professor Actual Factual "I just want a": so yeah, the answer to that is, no there isn't. But depending on why you use `ptr` you may be able to build your own safety net
17:47:26FromDiscord<Professor Actual Factual> Ah ok ty everyone
17:48:02FromDiscord<Professor Actual Factual> Id really love to avoid using ptrs but sharing memory across threads is impossible in nim otherwise.
17:48:31FromDiscord<Professor Actual Factual> Oh well 🙃
17:49:10FromDiscord<Yardanico> In reply to @Professor Actual Factual "Id really love to": but it is possible 🙂
17:49:23FromDiscord<Yardanico> with arc/orc
17:49:49FromDiscord<Professor Actual Factual> What? I thought only boehm allowed for this..?
17:50:02FromDiscord<Yardanico> arc/orc have a shared heap too
17:50:14FromDiscord<Professor Actual Factual> Wow, that is good news to me
17:51:29FromDiscord<Professor Actual Factual> Thank you, i will look into this later tonight. Was banging my ahead against the wall for hours yesterday learning about nims isolated thread memory. I guess orc arc are awesome
17:51:31FromDiscord<Yardanico> see https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html, https://nim-lang.org/blog/2020/12/08/introducing-orc.html, https://nim-lang.org/docs/destructors.html
17:51:33FromDiscord<dom96> arc/orc's shared heap is still `ptr`-based, no?
17:51:56FromDiscord<Yardanico> In reply to @dom96 "arc/orc's shared heap is": you can have a global GC'd object with arc/orc, but of course you need to be careful to avoid race conditions so you need to use locks if you want to write to it from multiple threads
17:52:14FromDiscord<Yardanico> because with --threads:on all memory in arc/orc is shared by default
17:53:49FromDiscord<dom96> It's way past time I play with this
17:54:07FromDiscord<dom96> I have a hunch that it's not that simple due to arc/orc not doing atomic ref-counts
17:54:29FromDiscord<Yardanico> for globals refcounts aren't really a problem
17:55:01FromDiscord<Yardanico> but you still need to do locks or something similar if you want to mutate the global variable from multiple threads
17:55:26FromDiscord<dom96> sure, but then you'd also have no problem with allocating shared memory yourself if it's global (since you don't have to worry about deallocating it)
17:56:13FromDiscord<Yardanico> yes, but using seqs or similar is still a bit better than using manually alloc'd memory :)
17:56:41FromDiscord<Yardanico> also there's https://github.com/nim-lang/threading
17:57:08FromDiscord<dom96> maybe a little bit, but then I'd be concerned about Nim's arc/orc decrementing/incrementing the ref count outside my lock implicitly
17:57:32FromDiscord<dom96> but I dunno, I'm effectively spreading FUD here, I need to try this out finally
17:59:09*stkrdknmibalz joined #nim
18:05:32FromDiscord<guzba> sent a long message, see http://ix.io/3HnH
18:06:09FromDiscord<guzba> (edit) "http://ix.io/3HnH" => "http://ix.io/3HnI"
18:10:27FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HnJ
18:10:42FromDiscord<Yardanico> uhh, i meant a global variable though
18:10:43FromDiscord<Yardanico> not a local one
18:11:08FromDiscord<Solitude> In reply to @guzba "currently supersnappy expects to": openarray is ptr + len. the point is with openarray user can pass any of the types mention or even view into them without copying. you literally arent sacrificiing anything.
18:12:21FromDiscord<Professor Actual Factual> (edit) "https://play.nim-lang.org/#ix=3HnJ" => "https://play.nim-lang.org/#ix=3HnK"
18:22:32FromDiscord<guzba> In reply to @Solitude "openarray is ptr +": sure, that looks true if im going to add ptr+len anyway. no harm in them wrapping it i guess. i'll still need to turn it back into ptr + len to hold it anywhere (eg bitstream in zippy) but supersnappy is simple enough to avoid that.
18:28:25*jjido joined #nim
18:35:10*PMunch quit (Quit: leaving)
19:00:25*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
19:02:48*u0_a185 quit (Ping timeout: 250 seconds)
19:22:43*jjido joined #nim
19:28:30*xet7 quit (Remote host closed the connection)
19:29:32*xet7 joined #nim
19:30:23*xet7 quit (Remote host closed the connection)
19:52:49*krux02 joined #nim
19:58:22FromDiscord<Michal58> What is the difference between `import math` and `import std/math`? I've always only used the former.
20:03:40FromDiscord<konsumlamm> they do the same, but the latter is preferred
20:04:01FromDiscord<konsumlamm> `std/` searches specifically in the stdlib
20:04:29FromDiscord<konsumlamm> if you had your own local module called `math`, it may conflict otherwise
20:05:24FromDiscord<konsumlamm> also some stdlib modules require the `std/` prefix (it may actually become mandatory for all stdlib modules in the future)
20:12:49*pch_ quit (Ping timeout: 265 seconds)
20:15:48FromDiscord<Michal58> ok, thanks
20:17:59nrds<Prestige99> PMunch if you're here, #nimdow should be bridged to libera if you want to just talk over the bridge
20:25:51*u0_a185 joined #nim
20:27:14FromDiscord<Sabena Sema> can you import std to make it search for all of them?
20:28:14FromDiscord<Sabena Sema> also: `using` is impossible to implement in the library without using term rewriting macros right?
20:29:20*pch joined #nim
20:52:52*u0_a185 quit (Ping timeout: 250 seconds)
20:54:53*nrds quit (Remote host closed the connection)
20:56:08*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:33:40NimEventerNew thread by Kcvinu: What is 'block' in this code, see https://forum.nim-lang.org/t/8696
21:38:11*vicfred joined #nim
22:26:18*u0_a185 joined #nim
22:34:04*jjido joined #nim
22:37:43*jjido quit (Client Quit)
22:38:22FromDiscord<ajusa> Anyone know how I can scrape a website behind Cloudflare? Using halonium but it doesn't seem to let me through to the actual website
22:50:01FromDiscord<dom96> I assume you're getting captcha challenges from Cloudflare?
22:50:25FromDiscord<dom96> or is there a different problem you're facing?
22:56:34FromDiscord<ajusa> Hm, there are a couple. I'm running this in headless chrome, but I still get a 503 error when it tries to do the redirect. I'm also trying to get it to print out the cloudflare challenge page using httpClient, but that doesn't work either (I get a 403 error, without the challenge body).
22:57:05FromDiscord<ajusa> So with httpclient I can't see the captcha, and with headless chrome via halonium, I think it solves the captcha but it doesn't proceed further.
23:05:37FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Hr3
23:06:56FromDiscord<ajusa> Ah I needed `print client.get(url).body()`, so that it wouldn't throw the exception while trying to read the body. Makes sense now
23:08:22FromDiscord<ajusa> Starting to think that nimpy + cloudscraper might be the best option for dealing with cloudflare, apparently they made a recent change that forced some other selenium solutions to stop working a few months ago.
23:18:09*nrds joined #nim
23:53:52arkanoidif I have an object type with just 1 field, is it always true that I can do unsafe cast from outside object type to inner type as basically is a struct with one field?
23:55:12FromDiscord<Elegantbeef> If it's an inherited object that might not be true due to type information added to the type
23:56:36arkanoidnot inherited
23:57:00FromDiscord<Elegantbeef> Then yea should be fine
23:57:10FromDiscord<Elegantbeef> Is there a reason you're using an object here?
23:58:54arkanoidno, I'm just trying to study python C-API tweaking nimpy, I'm not a C programmer so yeah just hacking around
23:59:08FromDiscord<Elegantbeef> I mean Nim has distinct types
23:59:09arkanoidI should really edit nimpy files and export fields
23:59:15FromDiscord<Elegantbeef> So like `type NotInt = distinct int`