<< 14-08-2023 >>

00:04:39FromDiscord<konsumlamm> In reply to @jordan4ibanez "So nim multidimensional arrays": if you mean the builtin `array`, yes, those have no indirections (but the compiler doesn't do anything special there, that's just what naturally happens)
00:10:36FromDiscord<jordan4ibanez> I'm used to java literally taking my array literal
00:54:40FromDiscord<arathanis> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/blob/version-2-0/li": how come the template is exposed but not the var temp to the surrounding scope?
00:54:46FromDiscord<arathanis> (edit) "temp" => "tmp"
01:07:45*lucasta quit (Quit: Leaving)
01:28:50FromDiscord<Elegantbeef> @arathanis\: cause you're not accessing `tmp` and do not provide it a name so it's gensym'd
02:01:06FromDiscord<m4ul3r> sent a code paste, see https://paste.rs/vU2Es
02:04:58FromDiscord<Elegantbeef> It's just `sect: untyped`
02:13:33FromDiscord<m4ul3r> It’s working, but moving it to the .data rather than the stack, so it’s something in the function. ↵Future me will look at why
02:13:50FromDiscord<m4ul3r> Something in assign chars
02:14:55FromDiscord<Elegantbeef> Eh I'd stop using a macro and just use a proc
02:23:24FromDiscord<terrygillis> Performance-wise and language-agnostic, how would inheritance/subtyping + dynamic dispatch using `method` compare to object variants + pattern matching `case`?
02:24:05FromDiscord<terrygillis> Nim seems to discourage method and dynamic dispatch
02:24:56FromDiscord<terrygillis> But logically, using a look-up table should be more efficient than going through all the cases right?
02:25:07FromDiscord<jakraes> I remember I was able to make a case of with ranges, is it still possible? I'm currently trying and I'm failing miserably 💀
02:25:21FromDiscord<Elegantbeef> `of a..b` works fine
02:25:22FromDiscord<heysokam> what was the way to force-import all symbols from a module, even those that are not public? 🤔
02:25:40FromDiscord<Elegantbeef> Nim's methods are not done using a table present
02:26:06FromDiscord<jakraes> In reply to @Elegantbeef "`of a..b` works fine": Yup, it works
02:26:10FromDiscord<Elegantbeef> The thing is though that's not the only thing to be concerned of when dispatching
02:26:11FromDiscord<Elegantbeef> You also have pointers for all your types with thrash your cache
02:26:11FromDiscord<Elegantbeef> `import x{.all.}`
02:26:12FromDiscord<Elegantbeef> presently
02:26:37FromDiscord<jakraes> I discovered the error in these last seconds tho, turns out I can't do 0..0.3 for example
02:26:42FromDiscord<jakraes> I need to use 0.0..0.3
02:27:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DoW
02:27:59FromDiscord<Elegantbeef> you can do `0f..0.3f`
02:28:11FromDiscord<Elegantbeef> The range has to be the same type on both sides
02:28:23FromDiscord<terrygillis> In reply to @Elegantbeef "You also have pointers": why does Nim `method` only work on ref types btw? is it because it's not using a table or sth?
02:29:01FromDiscord<Elegantbeef> It technically works on all types, the dynamic dispatch only works on `object of X` cause it needs type information
02:29:24FromDiscord<Elegantbeef> The entire point of dynamic dispatch is that you do not know the type you have statically and as such need a dynamic mechanism to call procedures
02:30:50FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DoY
02:30:54FromDiscord<Elegantbeef> `std/importutils`
02:31:09FromDiscord<Elegantbeef> Object fields are not on the module so require `privateAccess`
02:31:28FromDiscord<terrygillis> In reply to @Elegantbeef "It technically works on": The manually specifically says: "For dynamic dispatch to work on an object it should be a reference type." and the examples given are all ref types.
02:31:50FromDiscord<Elegantbeef> Right the manual says that cause unless you know what you're doing you're going to run through a mine field
02:32:34FromDiscord<Elegantbeef> It does technically work for non ref types, but you're supposed to use inheritance + dynamic dispatch with refs
02:32:40FromDiscord<Elegantbeef> Since non refs cannot be stored in a collection together, there is no reason to use dynamic dispatch with them
02:32:55FromDiscord<Elegantbeef> normal procs work just fine
02:34:48FromDiscord<heysokam> In reply to @Elegantbeef "Object fields are not": does that work on objects that are privately access with {.all.}?
02:34:55FromDiscord<heysokam> (edit) "access" => "accessed"
02:35:14FromDiscord<Elegantbeef> No clue I avoid hacks like that as much as possible
02:35:33FromDiscord<terrygillis> In reply to @Elegantbeef "Since non refs cannot": Ok, it's all over my head now, again 😢 What do you mean by "non refs cannot be stored in a collection together"?
02:35:52FromDiscord<Elegantbeef> How do you store two objects of different sizes inside of an array?
02:36:09FromDiscord<heysokam> In reply to @Elegantbeef "No clue I avoid": yeah same. but the idea is that only one of the fields needs to be exportd by the module, and the rest are opaque
02:36:31FromDiscord<heysokam> but they are imported by multiple files, so.... need to be `` in some way
02:37:03FromDiscord<terrygillis> In reply to @Elegantbeef "How do you store": Ah that's illuminating
02:37:33FromDiscord<Elegantbeef> The only reason you use inheritance and runtime dispatch is when you have a variable or collection which can contain multiple different types
02:37:49FromDiscord<Elegantbeef> With Nim's generics and overloading there is like 0 reason to do it otherwise
02:42:58FromDiscord<terrygillis> But generally speaking about programming languages, and assuming only heap-allocated types are considered (I'm meddling with some kind of tree traversal), am I right to assume subtyping + dyn dispatch (vtable supported) is faster than sumtypes/variants + match?
02:43:28FromDiscord<Elegantbeef> They're too different to really say if the dispatch is faster
02:44:47FromDiscord<Elegantbeef> If you can achieve the same logic with value types that are tagged unions it's likely to be the faster program as it does not have pointer indirection, and the switch can be converted to a jump table
02:44:55*pbsds quit (Quit: The Lounge - https://thelounge.chat)
02:45:30*pbsds joined #nim
02:47:25adigitoleoI want to update the void-linux package for Nim to v2. Looks like there aren't any major build changes, but just wanted to ask here in case.
02:47:25FromDiscord<Elegantbeef> It's mostly pointless to worry about the dispatch overhead and best just to write the program
02:48:26FromDiscord<arathanis> In reply to @Elegantbeef "<@136570191038513152>\: cause you're not": oh ok, so it actually is exposed but its gensymed so it'a name is mangled?
02:49:36FromDiscord<arathanis> looks like they are indeed exposed as tmp\`gensymN
02:50:00FromDiscord<Elegantbeef> Gensym is unaccessible
02:50:22FromDiscord<arathanis> oh ok i didnt know that
02:50:30FromDiscord<arathanis> is Gensym explained somewhere? in the manual?
02:51:03FromDiscord<Elegantbeef> Probably
02:53:10FromDiscord<terrygillis> In reply to @Elegantbeef "If you can achieve": btw can object variants in nim be considered a sumtype with a few quirks syntactically?
02:53:28FromDiscord<Elegantbeef> I mean they are sumtypes, depending on what your definition is
02:54:06FromDiscord<Elegantbeef> Tagged unions, sum types, rust enums, bleh bleh bleh.... people use 80000 different names to describe a simple concept
02:54:39FromDiscord<Elegantbeef> The most loosest definition of a sum type is "A type which allows storage of a single instance of a set of types"
02:57:16FromDiscord<terrygillis> Is Nim's object variants the `variant records` described in this blog: https://journal.stuffwithstuff.com/2023/08/04/representing-heterogeneous-data/
02:57:23FromDiscord<terrygillis> (edit) "Is Nim's object variants the `variant records` described in this blog: https://journal.stuffwithstuff.com/2023/08/04/representing-heterogeneous-data/ ... " added "?"
02:58:05FromDiscord<terrygillis> (edit) "`variant records`" => "`record cases`"
02:58:25FromDiscord<Elegantbeef> Yes Nim is descended from pascal
03:00:48FromDiscord<Elegantbeef> Using this list of definitions a sumtype is a specific implementation of a variant record or variant object as nim calls them
03:00:54FromDiscord<Elegantbeef> Or even object variant 😄
03:01:54FromDiscord<terrygillis> Is an object variant's size always constant regardless of the discriminator, as opposed to subtypes?
03:02:36FromDiscord<Elegantbeef> Correct
03:02:46FromDiscord<Elegantbeef> Well actually that's wrong sorta
03:02:54FromDiscord<terrygillis> Is there some optimization beneath that reduce obj variant size when not need? (just curious, i guess not)
03:03:16FromDiscord<Elegantbeef> Since all subtypes are pointer in-directed their value component is the size of a pointer regardless of their heap data size
03:03:46FromDiscord<Elegantbeef> Nah there is not one cause that'd require manual allocating at runtime based off the size and you're back to the issue of trying to put two different types in a single array
03:05:47FromDiscord<Elegantbeef> It doesnt solve any problems it just makes more
03:05:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Dp7
03:06:16FromDiscord<Elegantbeef> If you can move it to a smaller variant make a smaller variant, metagn's got some good ideas in a recent RFC about this
03:06:43FromDiscord<fit_z> Is there a package for dlib in nim ?
03:07:14FromDiscord<terrygillis> In reply to @Elegantbeef "Since all subtypes are": all subtypes invariably involve pointers?
03:07:44FromDiscord<terrygillis> It's not just copying the fields over and have a hidden field pointing to the base type right?
03:07:50FromDiscord<Elegantbeef> That is what `ref T` means and modern OOP languages use `class`s which are pointer indirected
03:08:26FromDiscord<terrygillis> but how about a subtype that is not a ref?
03:10:22FromDiscord<terrygillis> In reply to @terrygillis "It's not just copying": i mean, is `type A = object of B` represented as another different record types with the same fields of B and a hidden field `baseType: B`?
03:10:47FromDiscord<terrygillis> (edit) "types" => "type"
03:11:06FromDiscord<Elegantbeef> That's how Nim does it iirc, look at the generated C to see
03:14:07FromDiscord<terrygillis> Where is the `$HOME/nimcache` folder on Windows?
03:14:40FromDiscord<terrygillis> is it some environment variables because checking the list and there seems to be no HOME set?
03:14:47FromDiscord<Elegantbeef> Given I do not know I can only do the joke response of.↵I think you need to install\: https://www.debian.org/
03:15:08FromDiscord<Elegantbeef> you can do `--nimCache:someFolder`
03:20:59FromDiscord<terrygillis> In reply to @Elegantbeef "Given I do not": Hopefully one day :)) Got to stick to Win for now to work with others (I'm in a foreign country where Macbooks are still a foreign concept)
03:21:13FromDiscord<graveflo> In reply to @terrygillis "Where is the `$HOME/nimcache`": home is the same as `%USERPROFILE%` or something like that I think
03:21:32FromDiscord<Elegantbeef> I thought home was where .config was
03:21:33FromDiscord<graveflo> (edit) "home" => "`$HOME`"
03:21:35FromDiscord<Elegantbeef> \:d
03:22:14FromDiscord<graveflo> perhaps it should be
03:22:20FromDiscord<terrygillis> In reply to @graveflo "`$HOME` is the same": I found it thanks
03:34:51FromDiscord<aph> sent a code paste, see https://play.nim-lang.org/#ix=4Dp8
03:34:54FromDiscord<aph> sorry that's a big chunk of error
03:38:14FromDiscord<Elegantbeef> It's a bug due to the `union1` intialisation
03:38:32FromDiscord<Elegantbeef> No clue how to resolve it, I guess make an issue on github
03:38:37FromDiscord<Elegantbeef> Or search for it
03:41:56FromDiscord<aph> oh, ok thanks!
04:24:52*rockcavera quit (Remote host closed the connection)
04:39:57NimEventerNew thread by RedDirt: Networking with Nim, see https://forum.nim-lang.org/t/10405
04:48:54FromDiscord<arathanis> sigh atlas is busted
04:49:18FromDiscord<Elegantbeef> How?
04:49:53FromDiscord<arathanis> if you do `atlas init --deps=<depsfolder>` the first time you do `atlas use <package>` it will clone that package into the root instead of to `depsfolder` but all its dependencies and any subsequent `atlas use ...` will clone to the `<depsfolder>`
04:50:26FromDiscord<arathanis> so the first installed package gets dropped in the root
04:52:23FromDiscord<Elegantbeef> Seems like an easy fix though
04:52:38FromDiscord<arathanis> yeah
04:52:48FromDiscord<arathanis> but it might be hard to find a source
04:52:51FromDiscord<arathanis> its very weird behavior
04:52:59FromDiscord<arathanis> what logic makes it drop the first one into the root but no others?
04:53:51FromDiscord<Elegantbeef> Might just be a case that the first file does not load from the config creating this behaviour
05:05:30FromDiscord<arathanis> In reply to @Elegantbeef "Might just be a": so it looks like the issue is that when `choosenim` builds `2.0.0` it gets atlas 0.6.2
05:05:37FromDiscord<arathanis> which appears to have this problem
05:05:43FromDiscord<arathanis> but its fixed in 0.6.3
05:06:00FromDiscord<arathanis> which is what you get if you clone and build atlas from source
05:06:12FromDiscord<Elegantbeef> Cant you just `nimble install atlas` 😛
05:06:23FromDiscord<arathanis> that seems so cursed haha
05:08:34FromDiscord<arathanis> In reply to @Elegantbeef "Cant you just `nimble": it says it can't find the package when i try that rip
05:08:40FromDiscord<arathanis> you got my hopes up for nothing D:
05:09:07FromDiscord<Elegantbeef> `nimble install https://www.github.com/nim-lang/atlas`
05:10:10FromDiscord<arathanis> that installed 0.6.2 which explains why choosenim gets sad, what is the syntax for ignoring the tags and grabbing the head commit?
05:10:33FromDiscord<Elegantbeef> `@#head`
05:10:42FromDiscord<arathanis> that did it
05:11:01FromDiscord<arathanis> complete with all the compiler warnings 😍
05:11:05FromDiscord<Phil> TFW I need to check for tuples explicitly in my "getFields" proc+
05:11:34FromDiscord<Phil> Does micros NimNode equivalent for tuple also have a fields operator?
05:12:36FromDiscord<Elegantbeef> I do not have tuples wrapped
05:12:41FromDiscord<Phil> One sec, does micros do tuples?↵I don't.. ahh check
05:14:30FromDiscord<Elegantbeef> They're fairly simple, only have the `nnkTupleConstr`, `nnkPar`, `nnkTupleTy`
05:16:04FromDiscord<Phil> Hmm I could check for node if it's an object/ref object to use the micros way and for tuples I just iterate over the fields because thank god their typedefs can't be complicated
05:18:30FromDiscord<Elegantbeef> Right
05:46:00*xet7 joined #nim
05:49:39*azimut_ joined #nim
05:51:03*advesperacit joined #nim
05:51:54*azimut quit (Ping timeout: 246 seconds)
06:11:42adigitoleoWhat is the advantage of atlas over nimble?
06:12:36FromDiscord<Elegantbeef> Atlas should generally work better and is simpler 😄
06:12:45adigitoleoIs it stable?
06:12:52adigitoleoOr should I wait
06:13:23FromDiscord<Elegantbeef> It should be stable
06:13:30FromDiscord<Elegantbeef> Most of the issues are not about the program but features iirc
06:15:42*azimut_ quit (Ping timeout: 246 seconds)
06:33:07*PMunch joined #nim
06:48:44FromDiscord<arathanis> is there a way to annotate requires for certain nim versions?
06:49:02FromDiscord<arathanis> like "it requires this iff NimMajor == 2"
06:49:21FromDiscord<arathanis> (edit) "versions?" => "versions in nimble files?"
06:50:22PMunchHmm, I don't think so
06:50:44PMunchOr wait, Nimble files are just NimScript
06:50:59FromDiscord<Elegantbeef> You can use `when` but that's not really good to do
06:51:05FromDiscord<arathanis> that's a bummer. i wonder if that support will be added? otherwise packages are gonna have a fun time with "md5"
06:51:08PMunchSo you could try to do `when NimMajor >= 2: requires "something"`
06:51:35FromDiscord<arathanis> since if you `import md5` on Nim 2.0 you get a warning that should you install `checksums` and so `import checksums/md5`
06:51:35PMunchOh? What's going on with md5?
06:51:59FromDiscord<arathanis> (edit) "since if you `import md5` on Nim 2.0 you get a warning that ... should" added "you" | removed "you"
06:52:03FromDiscord<Elegantbeef> Just stop supporting nim 1943
06:52:22FromDiscord<arathanis> i guess nothing is stopping them from using checksums al the time
06:52:26FromDiscord<arathanis> i can support that
06:52:36PMunchWell a warning isn't all that bad
06:52:45FromDiscord<arathanis> context is im fiddling with a package that does't work on nim 2.0
06:52:49FromDiscord<Elegantbeef> My family was killed by a warning!
06:52:58FromDiscord<arathanis> and now im in its dependencies fixing their issues with 2.0
06:53:07FromDiscord<arathanis> good news: seems to run 😎
06:53:13PMunchNice!
06:53:29PMunchI have yet to go through my packages and fix things up for 2.0
06:53:37FromDiscord<arathanis> also it just has a straight up error that needs correcting
06:53:47FromDiscord<arathanis> nothing to do with 2.0 or not
06:53:49FromDiscord<arathanis> its just wrong lol
06:53:58PMunchHaha, that's always fun
06:54:08FromDiscord<arathanis> yeah, i think i hit an edge case they didn't test
06:54:18FromDiscord<arathanis> well i wouldn't call it an edge case
06:54:24FromDiscord<arathanis> but they must have not tested it
06:54:42PMunchI guess the way to solve this would be to have two versions of a package, one for pre-2.0 without the dependency, and one for post-2.0 with it. And then you'll have to lock version to the pre-2.0 one if you're not using 2.0
06:54:59PMunchIn the MD5 module?
06:55:03FromDiscord<arathanis> Beef's idea might be right, why not just make `checksums` a dependecy and always use that?
06:55:11FromDiscord<arathanis> In reply to @PMunch "In the MD5 module?": nah this is in the package
06:55:17PMunchRight
06:55:34PMunchSure, it doesn't hurt to install a package you don't need
06:55:41FromDiscord<arathanis> why try and differentiate between md5 and checksums/md5 when you can just use the latter lol
06:55:45PMunchOr wait, I guess you could use it in pre-2.0 as well
06:55:50FromDiscord<arathanis> exactly
06:55:51PMunchExactly
06:55:59FromDiscord<arathanis> anywho the error i found is
06:56:05FromDiscord<Elegantbeef> That was not my idea 😛
06:56:05FromDiscord<Elegantbeef> My idea was not to worry about schlubs wanting to use 1.6.x
06:56:11FromDiscord<arathanis> lmaaaaao
06:56:22FromDiscord<arathanis> does checksums not work on pre nim 2/
06:56:24FromDiscord<arathanis> (edit) "2/" => "2?"
06:56:56PMunchChecksums is probably just a copy of the old module, maybe with a nicer interface
06:57:07FromDiscord<arathanis> anywho, the error:↵its a mongodb lib↵↵if you pass in multiple hosts it does not properly inherit the username/password from the first host (as it shoudl according to the mongodb uri schema) so the hosts after the first fail to authenticate
06:57:27FromDiscord<arathanis> so you can't use replicals properly without a non-standard URI where you repeat the username/password for each host
06:57:32FromDiscord<arathanis> (edit) "replicals" => "replicas"
06:58:02FromDiscord<arathanis> `mongodb://username:password@host1,host2,host3`
06:58:32FromDiscord<arathanis> does not work, you have to↵`mongodb://username:password@host1,username:password@host2,username:password@host3`
07:04:25*junaid_ joined #nim
07:10:34*ntat joined #nim
07:47:55FromDiscord<bung8954> @ElegantBeouf why fungus not generate `getData` for me , that could be handy
07:48:18FromDiscord<Elegantbeef> What would `getData` do?
07:50:06FromDiscord<bung8954> return LineData or CircleData depends on kind in your example
07:50:39FromDiscord<Elegantbeef> How could that work
07:51:09FromDiscord<Elegantbeef> `getData` would have to be generic for that to work, but then it'd not work cause you need runtime information
07:51:52FromDiscord<Elegantbeef> If you want the tuple that badly just do `val.Line.distinctBase`
07:52:48FromDiscord<bung8954> I see, indeed.
08:04:22FromDiscord<System64 ~ Flandre Scarlet> Is there a good lib to make REST Apis please?
08:09:48FromDiscord<System64 ~ Flandre Scarlet> https://github.com/dom96/jester↵Maybe I can use that
08:12:25*fallback quit (Ping timeout: 240 seconds)
08:14:36*fallback joined #nim
08:20:18PMunchJester is pretty simple to work with
08:20:24PMunchBut there are also many alternatives
08:22:13PMunchBasically any web-server package should also be able to create a REST API
08:49:41FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DpN
08:50:22PMunchThe error should be pretty obvious..
08:50:44FromDiscord<odexine> You don’t have 80 parameters do you
08:51:13FromDiscord<System64 ~ Flandre Scarlet> Oh wait I'm dumb
08:52:59FromDiscord<System64 ~ Flandre Scarlet> paramStr is for arguments
08:55:28NimEventerNew Nimble package! propositionalLogic - A library for (standard) propositional logic, see https://github.com/Azumabashi/nim-propositional-logic/
09:35:16FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DpU
10:11:01FromDiscord<Phil> Wait for can't not be blocking.↵You can just delay where you call waitfor
10:12:06FromDiscord<System64 ~ Flandre Scarlet> And what about callback on Future?
10:22:20PMunchThis is what async is for..
10:22:31PMunchYou're supposed to use `await` instead of `waitFor` in this caes
10:24:12FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dq6
10:24:25FromDiscord<odexine> You don’t need to use callbacks
10:25:40FromDiscord<odexine> It would be better learn to use await first before resorting to callbacks or so
10:26:09FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dq7
10:26:30FromDiscord<odexine> Then make start auth window async
10:33:23FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dqa
10:42:00FromDiscord<odexine> Why not
10:42:08FromDiscord<odexine> Oh
10:42:28FromDiscord<odexine> I cannot read the code, the indentation looks fucked
10:43:08FromDiscord<System64 ~ Flandre Scarlet> the indentation is normal? 🤔
10:44:59FromDiscord<System64 ~ Flandre Scarlet> This is the entire login window code https://media.discordapp.net/attachments/371759389889003532/1140596926811738183/loginWindow.nim
10:49:26FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dqi
10:49:48FromDiscord<heysokam> `string | Path` is not compatible with `Path` ❔
10:50:15FromDiscord<odexine> Do you consume the return value
10:50:32FromDiscord<heysokam> I add it to a seq
10:50:47FromDiscord<heysokam> (edit) "seq" => "`seq[ShaderProg]` with `add`"
10:51:20FromDiscord<odexine> Perhaps is the path type it asks for different to the path type you use
10:51:21FromDiscord<ringabout> What's `gl`?
10:51:26FromDiscord<System64 ~ Flandre Scarlet> OpenGL
10:51:27FromDiscord<ringabout> > gl.newShaderProg(frag)
10:51:38FromDiscord<heysokam> In reply to @ringabout "What's `gl`?": `from myModule as gl import nil`
10:53:11FromDiscord<heysokam> In reply to @odexine "Perhaps is the path": I noticed some issues with `import std/[ os, paths ]`... where it was not able to resolve them as the same type
10:53:16FromDiscord<heysokam> maybe its related 🤔
10:53:44FromDiscord<ringabout> Does `proc newShaderProg(frag: Path):` or `proc newShaderProg(frag: Path | string): ShaderProg` match?
10:53:57FromDiscord<heysokam> let me try
10:54:35FromDiscord<heysokam> `Path | string` doesnt
10:55:26FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dqj
10:57:04FromDiscord<heysokam> Ok, yeah. so the other file is doing `import std/os` and the one with the proc is doing `import std/paths`... and they are resolved as different types
10:57:21FromDiscord<heysokam> that is hella annoying. aren't they both coming from the exact same type?
10:58:16FromDiscord<ringabout> Where is the Path thing from except `std/paths`. There doesn't seem to have another one in `std/os`/
10:58:19FromDiscord<ringabout> (edit) "`std/os`/" => "`std/os`."
10:58:25FromDiscord<ringabout> (edit) "`std/paths`." => "`std/paths`?"
11:00:24FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dqm
11:00:40FromDiscord<heysokam> In reply to @ringabout "Where is the Path": as far as i understand, os exports paths
11:01:16FromDiscord<heysokam> (edit) "https://play.nim-lang.org/#ix=4Dqm" => "https://play.nim-lang.org/#ix=4Dqo"
11:01:46FromDiscord<ringabout> I don't think so, could you find the export statements?
11:02:02FromDiscord<heysokam> you mean in os?
11:02:05FromDiscord<ringabout> yeah
11:02:16FromDiscord<heysokam> if I remove the std/os line it doesn't fail in that file
11:02:35FromDiscord<heysokam> that is already enough evidence? or is that not what you mean
11:03:48FromDiscord<odexine> os has no Path exported
11:05:02FromDiscord<heysokam> @ringabout https://github.com/nim-lang/Nim/blob/037f536e7ee25c4baf23dff8a4525825c506442c/lib/pure/os.nim#L32-L33
11:05:16FromDiscord<heysokam> In reply to @odexine "os has no Path": except it exports `ospaths2`
11:05:45FromDiscord<odexine> Does it have a path type?
11:05:45FromDiscord<ringabout> `ospath2` is based on `string`, not `Path`.
11:06:12FromDiscord<heysokam> In reply to @ringabout "`ospath2` is based on": aren't all `Path`s just a distinct string?
11:06:27FromDiscord<heysokam> In reply to @odexine "Does it have a": well definitely
11:06:35FromDiscord<odexine> Did you actually look?
11:06:41FromDiscord<heysokam> that's what i used on stable before it was released, by manually copying the contents of that file
11:07:06FromDiscord<heysokam> In reply to @odexine "Did you actually look?": I haven't, but i used to copy all contents from that file into a project for a few months, before they were released to stable
11:10:59FromDiscord<odexine> I see no Path type in any of the imports of OS
11:19:51*Brainzman joined #nim
11:21:46FromDiscord<heysokam> well wherever its coming from, i had to qualify it explictely with `paths.Path` in all calls and now it works 🤷‍♂️
11:31:49FromDiscord<heysokam> is there an existing way to remove a specific item or id from a seq?
11:32:46FromDiscord<nomad> So im trying to run a nim file, which works fine on my main machine. But im having problems running the file on a virtual machine. When trying to run the file in a vm, i get a missing dll error.↵↵Here is where i get confused. I wrote the program using only pure libraries, and i understood pure libraries dont need any dll's to run. Could somebody help me out?
11:33:28FromDiscord<nomad> The file is compiled on my main machine and then sent to the vm if that helps
11:34:05FromDiscord<heysokam> In reply to @nomad "So im trying to": that could be simplified to "my app doesn't work because my computer its missing a binary"↵its too ambiguous without any error messages for anyone to be able to help
11:34:21FromDiscord<heysokam> aka: post the error, otherwise its impossible to know
11:34:29FromDiscord<nomad> Alright one second
11:36:00FromDiscord<nomad> sent a code paste, see https://play.nim-lang.org/#ix=
11:36:32FromDiscord<nomad> Thats the error
11:38:43FromDiscord<odexine> In reply to @nomad "So im trying to": Did you compile with the SSL define
11:38:48FromDiscord<odexine> That needs the library you posted
11:39:01FromDiscord<odexine> (edit) "library" => "DLL on the error"
11:39:06FromDiscord<nomad> In reply to @odexine "Did you compile with": Yes i did
11:39:14FromDiscord<nomad> In reply to @odexine "That needs the DLL": Aah explains it
11:39:28FromDiscord<nomad> Well i really need ssl
11:40:05FromDiscord<nomad> Any way i could compile the nim file, and include the dll needed so to speak?
11:40:21FromDiscord<nomad> So i can send the file without needing a wizard or a ton of dll files
11:42:12FromDiscord<heysokam> In reply to @nomad "So i can send": thats the main problem with dynamic linking
11:42:30FromDiscord<demotomohiro> Why dont you ship with dlls?
11:42:51FromDiscord<heysokam> because you would need to ship every single potential dll on earth, which is nonsense
11:43:03FromDiscord<heysokam> that task is sent to the operating system
11:43:11FromDiscord<heysokam> and/or the user, depending on the os in question
11:43:39FromDiscord<nomad> In reply to @demotomohiro "Why dont you ship": I could but a single exe is a lot cleaner, and i dont have to have zip files and all that
11:44:03FromDiscord<heysokam> In reply to @nomad "I could but a": then you need to static-link with ssl in some way
11:44:22FromDiscord<nomad> Yeah thats what i was thinking, now the question is how
11:44:26FromDiscord<demotomohiro> You need to rebuild openssl to produce static link lib.
11:44:59FromDiscord<nomad> In reply to @demotomohiro "You need to rebuild": Sounds like a ton of work lol
11:45:03FromDiscord<odexine> Yes it is
11:45:18FromDiscord<odexine> You can use an alternative SSL implementation which is also a lot of work
11:45:47FromDiscord<nomad> Yeah, and i need http requests so no sll isnt an option
11:45:53FromDiscord<nomad> (edit) "sll" => "ssl"
11:46:16FromDiscord<demotomohiro> I saw many programs that are shipped with many dlls.
11:46:39FromDiscord<nomad> Yeah i know its not really uncommon in any way
11:46:50FromDiscord<odexine> Matter of preference
11:47:33FromDiscord<nomad> Could i perhaps use memlib in some way?
11:47:49FromDiscord<odexine> Use what?
11:48:07FromDiscord<nomad> https://github.com/khchen/memlib
11:48:56PMunchIsn't that exactly what memlib is used for?
11:49:41FromDiscord<nomad> Yeah i really dont know
11:50:32FromDiscord<nomad> Never used it
11:52:12FromDiscord<nomad> Ill look into it, thanks for the help guys
12:05:33*ntat quit (Quit: leaving)
12:13:37*azimut joined #nim
12:23:26*om3ga joined #nim
12:29:25FromDiscord<enthus1ast> i tend to use puppy for non async http calls these days
12:29:35FromDiscord<enthus1ast> this uses the os builtins
12:29:47FromDiscord<enthus1ast> winapi on windows and curl on linux and mac
12:30:52NimEventerNew thread by hamidrb80: [Scala background] How does a macro in Scala differs from macro in Nim?, see https://forum.nim-lang.org/t/10406
12:31:04FromDiscord<enthus1ast> but in any case, why not just make a folder with all the dll's required and zip it up?
12:31:48FromDiscord<odexine> In reply to @nomad "I could but a": .
12:35:36FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DqX
12:36:38FromDiscord<Hamid_Bluri> yeap
12:36:41FromDiscord<Hamid_Bluri> yep
12:36:49FromDiscord<System64 ~ Flandre Scarlet> It echo nothing
12:37:15FromDiscord<Hamid_Bluri> what `checkNameAvaillability` proc returns?
12:37:22FromDiscord<Hamid_Bluri> (edit) "what ... `checkNameAvaillability`return?" added "does" | "returns?" => "return?"
12:38:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/IeqXK
12:39:04FromDiscord<Hamid_Bluri> well maybe there is the body response of request`http://127.0.0.1/availlableName/{name}` is empty
12:39:12FromDiscord<Hamid_Bluri> (edit) removed "there is"
12:39:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @hamidb80 "well maybe the body": It works fine when I do waitFor
12:41:22FromDiscord<Hamid_Bluri> aren't you using the `client` in multiplie places??
12:42:15FromDiscord<System64 ~ Flandre Scarlet> this is the only place where client is really used
12:42:32FromDiscord<System64 ~ Flandre Scarlet> otherwise I pass it from function to function
12:42:40FromDiscord<Hamid_Bluri> if you try to send some code to reproduce this sitatation, I could help
12:42:58FromDiscord<Hamid_Bluri> otherwise I can't guess further
12:43:13FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1140626679966994463/loginWindow.nim
12:58:39*Brainzman quit (Quit: Brainzman)
13:06:26FromDiscord<heysokam> sent a long message, see http://ix.io/4Dr6
13:15:11FromDiscord<Hamid_Bluri> In reply to @sys64 "": man I've downloaded maybe around 300MB packages & deps and this code does not have a `main` function or anything to see the result
13:21:27FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=4Dr9
13:22:08FromDiscord<Hamid_Bluri> (edit) "https://play.nim-lang.org/#ix=4Dr9" => "https://paste.rs/Zgww3"
13:23:40*rockcavera joined #nim
13:36:20FromDiscord<System64 ~ Flandre Scarlet> Seems only WaitFor works
13:39:26PMunchProbably not properly ticking the async loop then
13:39:54FromDiscord<System64 ~ Flandre Scarlet> the async loop?
13:41:23PMunchAh, you discard your Futures..
13:41:41PMunchAnd you don't appear to tick the async event loop
13:42:04FromDiscord<System64 ~ Flandre Scarlet> How can I tick the event loop?
13:42:15PMunchWell it depends on the structure of your program
13:42:57PMunchYou can use `runForever` which will run until the async loop is out of work to do
13:43:09PMunchOr `waitFor` on some master task
13:43:22PMunchOr poll/drain for mine fine-grained control
13:43:23FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dri
13:43:28PMunchIt all depends on the structure of your program
13:43:37FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1140641885304655872/loginWindow.nim
13:43:42PMunchWell that's all well and good
13:43:43FromDiscord<System64 ~ Flandre Scarlet> And this is the login window
13:44:20PMunchBut since you discard `drawLoginTab` and `drawRegisterTab` in `drawApp` instead of awaiting them that won't do much
13:44:42PMunch`openLoginWindow` doesn't have any `await` statements, so it will just run to the bottom and complete
13:45:12PMunchdrawWindow, and drawApp both need to be `async`
13:45:46PMunch`drawApp` needs to `await` the other draw calls, and `drawWindow` needs to await `drawApp`
13:47:40PMunchOh, you also need to `await` your calls to `checkNameAvaillability`
13:48:10PMunchIn fact you should probably just read up on how async actually works..
13:48:27PMunchThis might help: https://peterme.net/asynchronous-programming-in-nim.html
13:49:12FromDiscord<System64 ~ Flandre Scarlet> Will read that
13:49:42FromDiscord<System64 ~ Flandre Scarlet> No freeze (I simulate a lag on the server) but nothing is printed https://media.discordapp.net/attachments/371759389889003532/1140643411477659721/loginWindow.nim
13:50:17PMunchWell since you've got your async code all kinds of wrong I'm not surprised you have bugs..
13:50:31PMunchReminds me of that good ol' Babbage quote
13:51:07FromDiscord<System64 ~ Flandre Scarlet> The server doesn't even print anything
13:51:14FromDiscord<System64 ~ Flandre Scarlet> like it was never called
13:51:14PMunch"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -Charles Babbage
13:51:33PMunchAgain, your code is all kinds of wrong, I'm not surprised in the slightest
13:52:39PMunchThe server probably is never called, because your code is wrong and doesn't do what you think it does
13:53:07*junaid_ quit (Remote host closed the connection)
13:54:35FromDiscord<enthus1ast> where do you actually drive your async loop?
13:58:41FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Drq
13:59:30PMunchWell it's *a* loop, but not *the* loop
14:00:20PMunchAh wait, you actually call `openLoginWindow` with `waitFor`, so at least that is correct
14:00:43PMunchStill doesn't fix all your other issues however
14:01:15FromDiscord<enthus1ast> it seems the matrix bridge has issues and i actually miss this whole discussion \:)
14:02:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Well it's *a* loop,": Well, sorry but I don't get this async loop thing :/
14:04:43FromDiscord<System64 ~ Flandre Scarlet> I mostly did async with Javascript
14:10:18*azimut quit (Ping timeout: 246 seconds)
14:17:35FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dry
14:19:31FromDiscord<System64 ~ Flandre Scarlet> Is that this async loop?
14:20:10PMunchDon't worry, it can be a bit tricky. JavaScript handles the async loop for you, but since Nim is a systems programming language you have to deal with it yourself
14:20:25PMunchThat is one way of running the loop, yes
14:20:58*PMunch quit (Quit: Leaving)
14:22:15FromDiscord<System64 ~ Flandre Scarlet> Aaaaaaah I now understand why I struggle so much!
14:22:18FromDiscord<odexine> I don’t recommend it
14:26:13FromDiscord<System64 ~ Flandre Scarlet> Is there any other method?
14:26:40FromDiscord<odexine> Run forever
14:26:42FromDiscord<odexine> The procedure
14:26:48FromDiscord<odexine> Somewhere in the module lol
14:28:05FromDiscord<enthus1ast> When you build a game, have you considered Netty instead of http?
14:29:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @enthus1ast "When you build a": Obviously↵I use http only for stuff outside the game, such as login or retrieving a list of the scores
14:31:20FromDiscord<enthus1ast> Then, if it's not an integral part of the game, maybe avoid "coloring" your functions with async
14:32:05FromDiscord<enthus1ast> But have a module that does this stuff in a thread, use puppy, and pull in the draw loop if it's done or not
14:32:17FromDiscord<enthus1ast> And poll
14:34:51FromDiscord<System64 ~ Flandre Scarlet> Login is only at the very stary
14:36:30FromDiscord<Dylan> Hello
14:38:00*azimut joined #nim
14:38:33FromDiscord<Dylan> Am a professional social account hacker and best in penetration testing as well.↵↵For more details let’s discuss this.
14:40:16*rockcavera quit (Read error: Connection reset by peer)
14:40:51*rockcavera joined #nim
14:40:51*rockcavera quit (Changing host)
14:40:51*rockcavera joined #nim
14:41:42FromDiscord<odexine> <@&371760044473319454> I think you’ll be interested in this offer
14:54:49FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DrI
14:55:23FromDiscord<enthus1ast> this should be poll()
14:55:29FromDiscord<odexine> It doesn’t, the procedure does as it says, so if you already have some global loop then maybe poll should be used
14:55:57FromDiscord<enthus1ast> but it could be also not working, since in drawWindow there could be multiple async calls
14:56:07FromDiscord<odexine> I only didn’t recommend it because I didn’t know you had a loop already
14:56:33FromDiscord<jviega> I'm such a non-fan of the whole async paradigm!
14:56:49FromDiscord<enthus1ast> when poll does not work, maybe try drain
14:58:07FromDiscord<enthus1ast> i would also not do this in a game loop, but maybe it works
14:58:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @enthus1ast "i would also not": It's not the game loop, the game loop comes later↵But drain works, but it lags
14:58:51FromDiscord<enthus1ast> then try to lower the timeout
14:59:14FromDiscord<enthus1ast> drain(16)
15:00:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @enthus1ast "drain(16)": thanks god IT FUCKING WORKS!
15:01:02FromDiscord<enthus1ast> nice
15:02:44FromDiscord<enthus1ast> @System64 ~ Flandre Scarlet\: you might want to calculate the ms to timeout (or go as low as possible) based on the frames you target
15:03:18FromDiscord<enthus1ast> but since its not in the gameloop you might be good to go \:)
15:05:29FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DrS
15:07:39FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/IP5KU
15:09:47FromDiscord<odexine> That’s cursed but sure
15:36:08*xet7 quit (Remote host closed the connection)
15:47:00*Brainzman joined #nim
16:21:56FromDiscord<yepoleb> In reply to @odexine "<@&371760044473319454> I think you’ll": What is your offer?
16:22:51FromDiscord<odexine> It’s gone lol
16:22:57FromDiscord<odexine> Some scammer posted
16:27:56FromDiscord<yepoleb> Yes but what is yours
16:41:48FromDiscord<odexine> I offer nothing in exchange for you to be more vigilant against spammers :baqua:
16:58:12FromDiscord<yepoleb> Garbage offer tbh
17:06:15FromDiscord<odexine> Who said it was any good
17:16:19NimEventerNew thread by fosilpro: Equivalent to Rust's Command spawn/try_wait? , see https://forum.nim-lang.org/t/10407
17:29:22*Brainzman quit (Ping timeout: 256 seconds)
17:42:38FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4Dsy
17:42:55FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=4Dsy" => "https://play.nim-lang.org/#ix=4Dsz"
17:43:07FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=4Dsz" => "https://play.nim-lang.org/#ix=4DsA"
17:44:22FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4DsC
17:51:18FromDiscord<System64 ~ Flandre Scarlet> Oh, thanks!
17:53:38*krux02 joined #nim
17:57:16*Guest86 joined #nim
17:57:31*Guest86 quit (Client Quit)
18:20:06FromDiscord<guttural666> isn't updating Nim done by again installing Nim with nimble install nim? or what am I doing wrong here? https://media.discordapp.net/attachments/371759389889003532/1140711458708127804/image.png
18:20:21FromDiscord<guttural666> or does choosenim do the job?
18:20:34FromDiscord<jos7388> i think choosenim is the one
18:20:46FromDiscord<jos7388> does anybody know how to do inline tests, rust style?
18:21:53FromDiscord<jos7388> something like this
18:21:56FromDiscord<jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4DsZ
18:21:59FromDiscord<jos7388> i just wanna stick my tests on the bottom of the file like people tend to do in rust
18:37:13FromDiscord<jos7388> i am extremely annoyed that testament requires tests to start with the letter "t"
18:37:17FromDiscord<jos7388> :cartired:
18:37:36FromDiscord<jos7388> i tried balls last time but i really didn't like it
18:46:06termerRunnable examples need to compile, but I don't know of inline tests specifically
18:46:20termerThough I'm not that knowledgeable on this part of the lang
18:48:17FromDiscord<jos7388> unrelated, with `codeReordering` enabled, i get an error when i `import strformat`
18:48:59FromDiscord<jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4Dta
18:49:01FromDiscord<jos7388> i'll post an issue i guess
18:49:26termerI believe codeReordering is no longer necessary in 2.0.0, but I could be wrong
18:50:20FromDiscord<jos7388> i think it is
18:50:34FromDiscord<jos7388> or at least my code only compiles with it enabled
18:53:08FromDiscord<jos7388> https://github.com/nim-lang/Nim/issues/22476
18:55:32termerHope the issue gets resolved for you quickly then
18:56:26NimEventerNew thread by IvanS: How to echo distinct type, see https://forum.nim-lang.org/t/10408
18:56:49FromDiscord<Phil> In reply to @guttural666 "or does choosenim do": choosenim stable (or install stable), sth like that
18:59:15FromDiscord<guttural666> In reply to @isofruit "choosenim stable (or install": yeah choosenim update 2.0.0 seems to have worked
18:59:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dtd
19:00:18FromDiscord<jos7388> i can try runnableexamples
19:00:22FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dtd" => "https://play.nim-lang.org/#ix=4Dtf"
19:00:25FromDiscord<guttural666> on a clean install on my other machine nimlsp also works again in Vim with everyting freshly installed, can't get it to work on my dev machine (broken for months now), fkn pain in the ass
19:00:42FromDiscord<Phil> In reply to @jos7388 "i can try runnableexamples": runnableExamples are basically like rusts compiled doccomment examples
19:01:06FromDiscord<Phil> They only get executed when compiling docs with `nim doc <file.nim>`
19:01:14FromDiscord<Phil> (edit) "doccomment" => "doc-comment"
19:01:39FromDiscord<Phil> Or just nim doc <your-key-project-file>.nim
19:03:05FromDiscord<jos7388> interesting
19:03:14FromDiscord<jos7388> i like the other approach
19:03:20FromDiscord<jos7388> i did try something like that though in the past, i forget why it gave me issues
19:03:26FromDiscord<jos7388> might have been because i used balls, can't remember, but im trying unittest2 now
19:04:42FromDiscord<Phil> In reply to @jos7388 "might have been because": For reference:↵@treeform uses that approach a fair bit for testing IIRC, as does the compiler itself.↵Further, I tend to use it to compile-in/compile-out certain features, e.g. in norm you can use it to compile-out logging (for performance)
19:05:53FromDiscord<jos7388> what framework do they use to test?
19:05:58FromDiscord<Phil> I'd use runnableExamples for the purposes of better documentation and the compiled-out section approach for "propper" tests with possibly a more complex setup.↵↵Generally I'm rather happy with just using std/unittest though
19:07:05*fallback quit (Ping timeout: 246 seconds)
19:07:06FromDiscord<Phil> Example:↵https://github.com/PhilippMDoerner/nimword/blob/main/tests/t_argon2.nim
19:08:17FromDiscord<jos7388> that makes sense to me, i'll use that approach too
19:08:23FromDiscord<jos7388> to me runnableExamples is good to make sure that your docs don't bitrot
19:08:29FromDiscord<jos7388> but it's just not enough structure for a proper suite of tests
19:08:42FromDiscord<Phil> Agreed
19:09:24FromDiscord<Phil> Out of curiosity, how do other langs deal with procs calling other procs?↵Do they have frameworks for monkey-patching the static dispatch?
19:10:34FromDiscord<krisp0> whenever I run my program in nim v2.0.0, is there a way to disable orc?
19:11:15FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dth
19:11:22FromDiscord<jos7388> i don't think rust does that
19:11:28termerWhen you say "disable orc", do you mean the cycle collector?
19:11:29FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dth" => "https://play.nim-lang.org/#ix=4Dti"
19:11:37termeror do you mean use the old refc collector?
19:11:45FromDiscord<jos7388> it sounds like a cool idea though, sounds like a very practical way to implement unit tests to me
19:11:50FromDiscord<Phil> In reply to @krisp0 "whenever I run my": You can specify which memory management strategy you want with the `--mm`flag
19:12:02FromDiscord<Phil> In reply to @jos7388 "it sounds like a": The thing is that it's hard as hell
19:12:14FromDiscord<Phil> At least for me who has very little to no propper grasp of low level stuff
19:12:28FromDiscord<jos7388> maybe, i think the compiler could just have a table for indirection and it would work just fine-- but i don't know any compilers that have something like that
19:13:10FromDiscord<Phil> The best I could come up with (or rather beef came up with) was a macro that turns `proc myProc()` into `var myProc = proc()...`.↵Which allows reassignment and is really cool...↵↵until you realize that generics aren't real and you can't mock generic procs that way
19:13:22FromDiscord<Phil> (edit) "with)" => "with upon my pestering)"
19:14:02termerkrisp0, To disable the ORC cycle collector, you can call GC_disableOrc to disable it at runtime, or you can use pure ARC with --mm:arc (no cycle collector at all). If you want to use the old refc GC, you can compile with --mm:refc.
19:14:07FromDiscord<Phil> I maybe need to give that another spin since I know a lot more about macros now than I did back then
19:20:25FromDiscord<krisp0> In reply to @termer "<@222794789567987712>, To disable the": refc is used by nim pre v2.0.0 right?
19:20:39termerYes
19:20:52termerWhy do you want to disable ORC?
19:25:52FromDiscord<jos7388> does anybody know how to patch your local nim install.. i want to fix the formatValue bug i linked earlier, it's blocking me
19:26:02FromDiscord<jos7388> some of my dependencies are using strformat and i can't avoid it
19:26:19FromDiscord<jos7388> i'm using choosenim if that helps
19:30:56termerif it's in the stdlib, you can edit it easily
19:31:08termerif it's a compiler issue, I don't know how to do that
19:32:20FromDiscord<krisp0> In reply to @termer "Why do you want": since it takes longer to compile my nim code compared to previous versions
19:33:30termerYou can use --mm:refc to use refc, but keep in mind that there are benefits to using ORC
19:34:04termerif you just want faster compile times during development and aren't taking advantage of ORC's features then you can use refc during development
19:34:34termerI've been using ORC ever since it came to 1.4.* so I've never noticed a compile time difference
19:36:52FromDiscord<Phil> In reply to @krisp0 "since it takes longer": Do you compile during development with `-d:release`?↵That one imo is the flag that impacts my compiletimes a fair bit more
19:37:51FromDiscord<krisp0> nope
19:37:53FromDiscord<Phil> `-d:release` and `-d:lto` both are immense slowdowns for compiletime.↵So during development I tend to never compile with them
19:38:01FromDiscord<Phil> hmm
19:38:19FromDiscord<Phil> Yeah then compiling with --mm:refc might be the way to go
19:38:26FromDiscord<Phil> (edit) "Yeah then compiling with --mm:refc ... might" added "during development"
19:39:03FromDiscord<Phil> I'd still want to use orc in general for my deployment builds, but eh
19:39:10FromDiscord<Phil> (edit) "eh" => "that can be a separate build-task"
19:39:40FromDiscord<jos7388> oh lord i have no clue how to fix this
19:39:49FromDiscord<jos7388> the broken line is in a macro that calls `bindSym("formatValue")`
19:39:55FromDiscord<jos7388> i guess i will order my code by hand
19:39:59FromDiscord<jos7388> <:sad_kermit:763192714085793853>
19:41:02FromDiscord<jos7388> aha
19:41:06FromDiscord<jos7388> i only had to move 3 declarations
19:41:09FromDiscord<jos7388> <a:PE_PandaFire:806808235150671893>
19:42:09termeryou can make the declarations and then define them later I think, C-style
19:42:18FromDiscord<jos7388> yup that's what i did for procs
19:42:38FromDiscord<jos7388> i kind of prefer to order things a certain way for readability, but it's okay
19:42:49termerI know the pain
20:03:09FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1140737394073669752/image.png
20:03:10FromDiscord<jos7388> lovely!!!!!!!!
20:03:13FromDiscord<jos7388> best language ever!!!!!!!!!
20:03:19FromDiscord<jos7388> inline tests!!!!
20:05:01termermagic
20:05:14termercan't tell how sarcastic you're being lol
20:05:30FromDiscord<jos7388> no it's quite nice 🙂
20:05:35FromDiscord<Elegantbeef> PS if you lexer works at CT make `expression(src: static string)` 😄
20:05:37FromDiscord<jos7388> very few languages give you this much control over everything
20:05:37termeralso what font is that
20:05:44FromDiscord<jos7388> umm let me check
20:05:54FromDiscord<Elegantbeef> No termer you're supposed to flame their white theme
20:06:10FromDiscord<jos7388> https://github.com/protesilaos/iosevka-comfy
20:06:16FromDiscord<jos7388> i love this font
20:06:17termerI'm more interested in the rounded sans font
20:06:30termernot in the mood for a theme war today
20:06:33termermaybe tomorrow
20:06:41FromDiscord<jos7388> i change color themes a lot 🙂
20:06:48FromDiscord<jos7388> sometimes light is nice!!!
20:06:58termerI choose something and stick with it for years
20:07:36termerlol of course the font creator is an Emacs autist
20:07:39FromDiscord<Elegantbeef> Termer has not changed his underpants since the obama administration
20:07:51termerYou're not supposed to know that
20:08:01FromDiscord<Elegantbeef> I can smell it from here
20:08:12FromDiscord<Elegantbeef> Skidsmark mcgee
20:08:33termerAnd yet your scent hasn't escaped me since I started using Nim
20:08:52FromDiscord<Elegantbeef> Much like skunk, it has a long staying time
20:08:59termerI suppose it's mutual
20:09:22FromDiscord<Elegantbeef> Did you see the nico script stuff termer? I know you said a fantasy console would be nifty, and it's on the way to that path 😄
20:09:47termerI did see that but didn't pay any attention
20:10:07termeris it just live reloading Nim scriptd
20:10:12termerscripts
20:10:19FromDiscord<Elegantbeef> Yea
20:10:34termerIsn't Nick a game enginr
20:10:36termerengine
20:10:37termerfuck
20:10:44termerNICO
20:10:46FromDiscord<Elegantbeef> Nah he's a person
20:10:48FromDiscord<Elegantbeef> Nico is a game framework yea
20:11:17termerI think that's why I didn't pay attention cause I assumed it only applied to Nico
20:11:47FromDiscord<Elegantbeef> Well it's just nimscripter's new dynamic library API applied to nico
20:12:25termerCool
20:12:38termerMeanwhile I'm still waiting for real hot code reloading
20:13:24FromDiscord<Elegantbeef> I did have an idea using term rewriting macros to make HCR work, but I stopped myself down that path
20:13:36termerthat sounds horrendous
20:13:42FromDiscord<jmgomez> HRC you mean the one in the compiler?
20:13:54FromDiscord<Elegantbeef> Me? No
20:13:57termerHRC in the compiler doesn't work
20:14:08FromDiscord<Elegantbeef> Especially since it's HCR
20:14:17FromDiscord<jmgomez> Yeah, it should be striped away
20:14:56termerI want IC, I want HCR, I want CPS! I want all the acronyms, and I want them now!
20:15:15FromDiscord<Elegantbeef> This is the sad story of how termer got AIDS
20:15:24termerAHAHAHA
20:15:42FromDiscord<jos7388> weird, my tests are marked as OK even if an exception is thrown
20:15:52termerAdd try catch lol
20:15:56termerI dunno
20:16:12FromDiscord<Elegantbeef> `except: discard` 😛
20:16:21termerhehehe
20:16:33FromDiscord<Phil> In reply to @jos7388 "": Hmm what result lib you using?
20:16:42FromDiscord<jos7388> my own
20:17:04FromDiscord<Phil> Can you specify an arbitrary amount of error-parts of the result without too much typing?
20:17:12FromDiscord<Phil> (edit) "error-parts of" => "error-types for"
20:17:40FromDiscord<Phil> Like, result may be "okay" or "Err1" or "Err2" (those may be exception types or whatever) etc.?
20:17:45termerexcept: quit 0
20:18:09FromDiscord<Elegantbeef> I mean just make a type that takes a tuple and expands into a variant
20:18:22FromDiscord<Elegantbeef> Boom, instant varadic results
20:18:25FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1140741236752392313/image.png
20:18:32FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1140741263679815681/image.png
20:18:39FromDiscord<jos7388> :thonkomega:
20:19:04FromDiscord<graveflo> try making it a template?
20:19:10FromDiscord<jos7388> that would probably work
20:19:16FromDiscord<jos7388> if i don't have the fn there it's fine
20:19:52FromDiscord<jos7388> idk.. seems a little fragile though?
20:19:53FromDiscord<graveflo> `test` is a macro-ish thing. It matters that `check` is in the AST
20:20:18FromDiscord<Phil> I'm reasonably certain that std/unittest does not play nice at all with checks not being directly in a test-block
20:20:26FromDiscord<Phil> Was one of the limitations I stumbled into IIRC
20:20:37FromDiscord<jos7388> i guess ill just use assert for now
20:20:51FromDiscord<Phil> It does effectively the same, check simply provides nicer error messages IIRC
20:20:52FromDiscord<graveflo> you can just to asserts or exceptions or return values if you really want to use procs like that
20:21:10FromDiscord<Elegantbeef> Just use balls
20:21:10FromDiscord<Elegantbeef> Everyone loves balls
20:21:22FromDiscord<graveflo> wait HUH
20:21:28FromDiscord<pelfox> how can I read bytes from tcp connection as a seq instead of string?
20:21:42FromDiscord<jos7388> i tried balls but had some issues
20:21:42FromDiscord<Elegantbeef> Use the raw procs
20:21:45FromDiscord<jos7388> maybe ill try again
20:21:47FromDiscord<Elegantbeef> But now why do you want a seq instead of a string
20:22:07FromDiscord<pelfox> sent a code paste, see https://play.nim-lang.org/#ix=4DtN
20:22:29FromDiscord<Phil> Balls docs completely hasn't managed to convince me of why I would use it over just std/unittest
20:22:33FromDiscord<Elegantbeef> You didnt allocate
20:22:33FromDiscord<Elegantbeef> `bytes = newSeq[byte](1024)`
20:22:34FromDiscord<Elegantbeef> also `bytes[0].addr`
20:22:34FromDiscord<Elegantbeef> But again
20:22:50FromDiscord<Elegantbeef> Why do you need `seq[byte]` that `.toOpenArrayByte(0, str.high)` would not work
20:24:50FromDiscord<pelfox> In reply to @Elegantbeef "Why do you need": I didn't thought about it, idk why, thank you
20:25:25FromDiscord<Elegantbeef> No problem, you can always use a seq[byte] with my changes if you really really must, just wrap it in a proc to make it sane
20:29:02termerDoes anyone know whether there are any utils in std that can help with treating an openarray of chars as a string?
20:30:08termerI'm trying to write a zero-allocation HTTP parser
20:37:25*Guest72 joined #nim
20:39:26*Guest72 quit (Client Quit)
20:43:56FromDiscord<Elegantbeef> Why would you need that use std/parseutils
20:44:55FromDiscord<Elegantbeef> Everyone's favourite asshat made `parseutils` and `unicode` work with `openArray[char]` so be merry and use that work
20:46:19FromDiscord<Elegantbeef> It's also impossible to convert an `openArray` to `string` or `seq` without allocating
21:19:28FromDiscord<bung8954> `var info = getAddrInfo( "127.0.0.1", Port(9000))` `info.ai_addr` empty?
21:20:07FromDiscord<bung8954> I need pass into `proc connect(s: SocketHandle; name: ptr SockAddr; namelen: SockLen): cint` now I get `-1`
21:32:43FromDiscord<Elegantbeef> Is it still nil with a different address?
21:39:49*fallback joined #nim
21:52:05*advesperacit quit ()
21:54:25FromDiscord<bung8954> yes, just tried. no clue
21:59:59FromDiscord<nomad> how do i upload files as multipart data with puppy?
22:01:18FromDiscord<Elegantbeef> https://github.com/treeform/puppy#examples
22:01:40FromDiscord<nomad> yea i saw that but didnt understand it
22:01:55FromDiscord<nomad> ive been working with httpclient and its late, my brain is slow right now
22:02:11FromDiscord<nomad> (edit) "ive been working with httpclient ... and" added "until just now"
22:02:33*Guest81 joined #nim
22:03:00*Guest81 quit (Client Quit)
22:03:59FromDiscord<nomad> sent a code paste, see https://play.nim-lang.org/#ix=4Dug
22:04:05FromDiscord<nomad> how do i do that with puppy
22:04:37FromDiscord<nomad> (edit) "https://play.nim-lang.org/#ix=4Dug" => "https://play.nim-lang.org/#ix=4Duh"
22:04:39FromDiscord<Phil> Plain text file?
22:04:52FromDiscord<nomad> yeah
22:05:02FromDiscord<nomad> mostly txt and dll files
22:06:03FromDiscord<Phil> What part of the example is confusing?↵Basically for payload, just read in the plain-text file into a string, is that the bit that's difficult?
22:06:32FromDiscord<Elegantbeef> I mean isnt it the exact same as the httpclient api?
22:06:35FromDiscord<heysokam> is it possible to define the `--gc` being used from a pragma?↵is there a switch pragma or something, similar to how there is a `{.define: symbol.}` one? 🤔
22:06:39FromDiscord<Elegantbeef> Also phil isnt that dumb to load the file into a string
22:06:53FromDiscord<Elegantbeef> No there's no way of changing the GC inside Nim
22:06:53FromDiscord<nomad> wait i might be really dumb right now let me test
22:07:15FromDiscord<Phil> In reply to @Elegantbeef "Also phil isnt that": Depends on the size of the file, for quick and dirty that's absolutely an option
22:07:55FromDiscord<Elegantbeef> Right, but isnt a point of multipart data to stream it, or am I missing what multipart means 😄
22:08:08FromDiscord<Phil> But generally when you send plain text around you tend to not be sending massive amounts
22:08:18FromDiscord<nomad> In reply to @isofruit "Depends on the size": i could most likely load the file into a string
22:08:19FromDiscord<Phil> Video and audio are the heavy stuff, so might as well not give a hoot about memory
22:09:21termerElegantbeef, "It's also impossible to convert an `openArray` to `string` or `seq` without allocating" I'm aware, that's why I was wanting to operate on openArray
22:09:37termeralso is it possible to make my own implementation of openArray?
22:09:46FromDiscord<Elegantbeef> But you asked to convert an openArray to a string 😄
22:09:51FromDiscord<Phil> I'd be suggesting something else if I saw anywhere in the puppy API a way to pass on a file handle or the like
22:09:54FromDiscord<heysokam> is it possible to disable exceptions usage completely?
22:09:54FromDiscord<Elegantbeef> make a template
22:09:55termerdid I
22:10:19termerI've got effectively a seq but stack allocated
22:10:46FromDiscord<Elegantbeef> Right write `openArray[char]` and carry on
22:11:29FromDiscord<Elegantbeef> `template toOpenArray(...): untyped = cast[ptr UncheckedArray[char]](myData[0].addr).toOpenArray(0, size)`
22:12:05FromDiscord<Elegantbeef> Likely do not need the cast assuming you have `(len, array[size, char])`
22:12:16FromDiscord<Elegantbeef> No it's not possible to disable exceptions sokam
22:12:31FromDiscord<Phil> In reply to @nomad "i could most likely": If it's small enough ( a couple MB at most) that should be all good then.↵Read it in, throw it in as a body, done
22:12:41FromDiscord<nomad> In reply to @isofruit "I'd be suggesting something": i feel so dumb right now, but i can not make it work for the life of me
22:12:46termerI need to look at the definition of openArray apparently
22:12:52FromDiscord<nomad> lets say i have a file called test.txt
22:13:06FromDiscord<nomad> how do i send it as multipart data
22:13:06termermy object is just an object with an int and array
22:13:17FromDiscord<Elegantbeef> Right
22:13:24termernomad, Read httpclient docs
22:13:27FromDiscord<nomad> so sorry for all the dumb questions btw
22:13:35FromDiscord<Phil> In reply to @nomad "how do i send": The filepath you try to read the file from is relative to your binary, you taken that into consideration?
22:13:35termerit shows you how to do it in an example I think
22:13:40FromDiscord<nomad> termer im working with puppy
22:13:53FromDiscord<Phil> Note that your binary is not necessary in the same dir as your project.nim file
22:13:53FromDiscord<nomad> In reply to @isofruit "The filepath you try": same dir
22:13:56FromDiscord<Elegantbeef> so your template should be `template toOpenArray(myStr: MyString): untyped = myStr.data.toOpenArray(0, myStr.len)`
22:14:01termercan't help you with puppy, sorry
22:14:13FromDiscord<nomad> no the exe, nim and txt is all in the same dirs rn
22:14:14FromDiscord<Elegantbeef> Sadly there is no mechanism to overload `toOpenArray` to convert implicitly
22:14:16FromDiscord<nomad> (edit) "dirs" => "dir"
22:14:22termerElegantbeef, Thanks
22:14:41termerI mean, I could use converter, right?
22:18:42FromDiscord<Phil> In reply to @nomad "no the exe, nim": What's the path you're looking at?
22:19:09FromDiscord<Phil> sent a code paste, see https://paste.rs/g269m
22:19:23FromDiscord<Elegantbeef> No you cannot use converters cause openArrays cannot be return types
22:19:26FromDiscord<Elegantbeef> I'd probably suggest a concept
22:19:39termerwhat the fuck lol
22:19:40FromDiscord<Elegantbeef> Phil you can just do `lines("fileName")` and cut the middle man and not leave a file handle open
22:19:46termerAmazing
22:20:09FromDiscord<Elegantbeef> Remember termer openArrays can point to the stack so without a borrow checker dangling pointers could happen
22:20:13FromDiscord<nomad> sent a code paste, see https://play.nim-lang.org/#ix=4Duk
22:20:53FromDiscord<nomad> sent a code paste, see https://play.nim-lang.org/#ix=4Dul
22:21:01termerI suppose that makes some sense
22:21:12termerbut that template is safe, right?
22:21:19FromDiscord<nomad> the body is empty
22:21:19FromDiscord<Elegantbeef> Yea of course
22:21:23FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dun
22:21:37FromDiscord<nomad> yeah i get 200 ok code so it gets through
22:21:43FromDiscord<nomad> but the body is empty
22:22:13FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4Duo is another alternative termer
22:23:13FromDiscord<Phil> In reply to @nomad "yeah i get 200": As in, your server receives it as an empty body?
22:23:20FromDiscord<nomad> yes
22:23:21FromDiscord<Elegantbeef> That would allow the builtin types and any user defined ones with a relatively simple API to cover
22:24:13FromDiscord<Phil> Just to double check, based on what is the server stating it is an empty body?↵Mostly asking because the body puppy returns is a valid multipart request body so that should work without issue
22:25:20FromDiscord<nomad> sent a code paste, see https://paste.rs/o70dM
22:25:28FromDiscord<nomad> and the console shows `{}`
22:25:54FromDiscord<Phil> Can you log the entire request?
22:25:59FromDiscord<nomad> sure
22:27:35FromDiscord<Phil> I'm not insanely familiar with JS server frameworks (at least that's what that looks like). ↵Some frameworks treat multipart requests as separate from the body, depending
22:28:52FromDiscord<nomad> In reply to @isofruit "I'm not insanely familiar": i am so dumb lol
22:28:57FromDiscord<nomad> that was the issue
22:29:28FromDiscord<nomad> my several years of javascript was defeated by lack of sleep
22:30:11FromDiscord<Phil> 😄 ↵Today is the day of my troubleshooting
22:30:57FromDiscord<Phil> Burnt out at least a hundred brain cells at work to finally figure out how a colleague of mine's refactor broke our new microservice, managed to spot an issue with another colleague of mine's useage of a job and now this
22:31:24FromDiscord<Phil> (edit) "Burnt out at least a hundred brain cells at work to finally figure out how a colleague of mine's refactor broke our new microservice, managed to spot an issue with another colleague of mine's useage of a ... job" added "scheduled"
22:31:39FromDiscord<nomad> phil the phixer
22:31:39FromDiscord<Phil> As a sidenote: Java magic is the worst
22:32:12FromDiscord<nomad> In reply to @isofruit "As a sidenote: Java": anything java is beyond me
22:32:18FromDiscord<nomad> (edit) "phil the phixer ... " added "(fixer)"
22:32:48FromDiscord<nomad> well im gonna go sleep before i do more dumb shit
22:33:01FromDiscord<nomad> thanks for the help
22:36:23termerIs it possible to do an unsafe get on an array without having to do pointer fuckery?
22:36:54termerI know that bounds checks are disabled on danger, but for my implementation, I want to avoid a check since I'm already doing a check
22:37:41FromDiscord<Elegantbeef> `{.boundChecks:off.}` iirc
22:38:07termerdoesn't seem to be a valid pragma
22:38:17FromDiscord<Elegantbeef> `bounds`...?
22:38:55FromDiscord<Elegantbeef> I always forget
22:39:18termerno luck
22:39:27FromDiscord<Elegantbeef> You lied to me
22:39:54FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4Duq
22:40:03FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#pragmas-compilation-option-pragmas
22:40:32termerOh, I was trying to use it inside of a proc
22:41:18termerthis is tricky
22:42:38termerI need to disable bounds checks on one specific line, and also check if checks are enabled so I can do my own check
22:51:44FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dut
22:51:52FromDiscord<Elegantbeef> Would be ugly but could define two procs 😄
22:51:53FromDiscord<heysokam> i can't find what in my code is calling for that (if any)
22:52:16FromDiscord<Elegantbeef> Are you using assert?
22:53:28FromDiscord<heysokam> oh im using doAssert
22:53:43FromDiscord<heysokam> i guess that raises exception, right
22:57:01FromDiscord<heysokam> is there a way to quit and print a backtrace (without exceptions)?
22:57:25FromDiscord<Elegantbeef> `writeStackTrace()`
22:59:45FromDiscord<heysokam> tysm!
23:27:43*rockcavera quit (Read error: Connection reset by peer)
23:28:29*rockcavera joined #nim
23:28:29*rockcavera quit (Changing host)
23:28:29*rockcavera joined #nim