<< 30-12-2024 >>

00:00:30FromDiscord<zumi.dxy> I know how in Go, errors are chiefly "just strings"↵differentiating them is a pain I've heard
00:00:56FromDiscord<Elegantbeef> Well in Go an error is whatever the programmer feels like doing
00:01:13FromDiscord<Elegantbeef> Want to use a bool, a sentinel, a string, you do you!
00:01:13FromDiscord<zumi.dxy> In reply to @Elegantbeef "It's akin to saying": "return int, if 0 success, otherwise fail, the actual error is in `errno`"
00:02:18FromDiscord<zumi.dxy> `if (something) { / sad path / return -1; }`↵Very intuitive™️
00:02:57FromDiscord<Elegantbeef> Heh, it relies on the programmer to meet the contract and it loses stack information
00:10:15*beholders_eye quit (Ping timeout: 265 seconds)
00:21:05FromDiscord<albassort> just lost 2 hours of time debugging an issue via a backwards > because I changed it to debug a code path
00:21:11FromDiscord<albassort> but didn't comment to change it back
00:21:12FromDiscord<albassort> lole
00:23:32FromDiscord<albassort> this stuff doesn't even upset me anymore
00:26:51FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=QscbTFKF
00:27:04FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=XjAfNMRx
00:28:05FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Heh, it relies on": isn't that why backtraces or smth exist?
00:28:26FromDiscord<Elegantbeef> For C?
00:49:29FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "For C?": iirc there's a bindings for the lib
00:51:15FromDiscord<Elegantbeef> I don't know how that helps with errno
00:53:56FromDiscord<Robyn [She/Her]> you're said how results lose stack information, no? which is why you can use backtraces with results? unless I've misunderstood your poiny
00:53:58FromDiscord<Robyn [She/Her]> point
00:54:27FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1323091799207837706/image.png?ex=677340c2&is=6771ef42&hm=e130510f67f076b821596002951512d659148b8317de11eca2b465520615ee7d&
00:56:15FromDiscord<Robyn [She/Her]> ah
00:56:20FromDiscord<Robyn [She/Her]> okay i get it :p
00:56:36FromDiscord<Elegantbeef> Robyn really hates linear conversations
01:28:19*HER quit (Quit: leaving)
01:56:14FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Robyn really hates linear": I'm very used to juggling multiple conversations like a clown juggles balls :sobs:
03:34:23*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
03:48:33*SchweinDeBurg joined #nim
04:13:31FromDiscord<spaceshaman> So object construction
04:13:58FromDiscord<spaceshaman> Is it indentation sensitive within the parens?
04:15:44FromDiscord<spaceshaman> Or is it like python where delimiters turn off indentation sensitivity?
04:16:19FromDiscord<janakali> sent a code paste, see https://play.nim-lang.org/#pasty=sSoqaOiL
04:19:16FromDiscord<bostonboston> In reply to @spaceshaman "Is it indentation sensitive": In general I think commas allow statements to span multiple lines, I don't see why this wouldn't apply in an object constructor↵↵Is this what you're referring to? ↵https://play.nim-lang.org/#pasty=BAeVHujw
04:21:59FromDiscord<spaceshaman> In reply to @bostonboston "In general I think": Ah. Looks like im right.
04:22:39FromDiscord<spaceshaman> The commas don't actually affect it. Its just that they appear in the same places
04:23:38FromDiscord<spaceshaman> https://play.nim-lang.org/#pasty=ZdlSOWax
05:01:28*rockcavera quit (Ping timeout: 252 seconds)
05:05:54*rockcavera joined #nim
05:05:54*rockcavera quit (Changing host)
05:05:54*rockcavera joined #nim
05:35:39FromDiscord<blackmius> In reply to @riku5543 "Alright that makes a": i dont understand share the code example
05:38:33FromDiscord<blackmius> sent a code paste, see https://play.nim-lang.org/#pasty=DMJpYbQe
05:40:11FromDiscord<blackmius> and it work as expected↵↵https://play.nim-lang.org/#pasty=kPnmRqFs
05:44:00FromDiscord<riku5543> I don't know what I did but I can't reproduce it anymore..
05:45:00FromDiscord<riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=LzukMPRG
05:55:52*xet7 quit (Remote host closed the connection)
06:06:27FromDiscord<lainlaylie> Don't know if it's been mentioned yet but one thing to keep in mind is that the default calling convention for proc types is closure, but for actual proc definitions it's nimcall unless specified via a pragma or necessitated by scope access
06:44:45FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=HXnCAsev
06:45:39FromDiscord<riku5543> Alright
07:08:53*coldfeet joined #nim
08:43:07FromDiscord<micl2e2> Nim's binary is always named the same as the project's name or source file's name, quite reasonable, except a bit inconvenience, e.g. one needs to exclude those binaries one by one if the working directory is subdir of a git repo and also assuming that `git add .` is being used frequently. ↵↵ 😦 Any others felt the same way in such kind of situations? Would it be feasible binaries are named with an additional suffix/ext, for exa
09:06:54FromDiscord<lainlaylie> There are options you can use to set the output filename
09:07:07FromDiscord<lainlaylie> See also the first few lines of https://github.com/nim-lang/Nim/blob/devel/.gitignore
09:09:12FromDiscord<lainlaylie> Also, if your project directory contains a subdirectory with the same name as the module you're compiling, the output filename does receive a .out suffix
09:17:46FromDiscord<micl2e2> Yes, using gitignore in reverse is a nice trick, but that would also rule out other non-extension files
09:18:24FromDiscord<lainlaylie> The other two suggestions still stand
09:21:10FromDiscord<micl2e2> Thanks for those anyway 🙂 actually I knew they could be resolved, just looking for another more smooth and neater way to achieve it
09:28:54FromDiscord<micl2e2> just automatically adding a ext name to the binaries, can spare the repository from reverse ignoring hacking, and also save numerous keystrokes if the language has numerous audiences, would vote for that, since such a small effort could possibly bring huge benefit in terms of long-term language ecosystem development
09:38:42FromDiscord<lainlaylie> sent a long message, see https://pasty.ee/dtBoJfGy
09:41:57FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=MZTuCkhp
10:11:34*ntat joined #nim
10:50:08*coldfeet quit (Quit: Lost terminal)
10:52:58*coldfeet joined #nim
11:22:53*xet7 joined #nim
11:27:54*beholders_eye joined #nim
11:51:08FromDiscord<ambient3332> Is something like nph a good option for formatting Nim source files?
11:53:03FromDiscord<zumi.dxy> practically the only option since nimpretty can actually break your source files :p
11:54:25FromDiscord<ambient3332> Ok, good
12:18:38*beholders_eye quit (Ping timeout: 265 seconds)
12:37:19*thunder joined #nim
12:46:35*xet7 quit (Remote host closed the connection)
13:32:53*tiorock joined #nim
13:32:53*rockcavera is now known as Guest1056
13:32:53*Guest1056 quit (Killed (mercury.libera.chat (Nickname regained by services)))
13:32:53*tiorock is now known as rockcavera
13:34:58*tiorock joined #nim
13:34:58*tiorock quit (Changing host)
13:34:58*tiorock joined #nim
13:34:58*rockcavera is now known as Guest2483
13:34:58*Guest2483 quit (Killed (tantalum.libera.chat (Nickname regained by services)))
13:34:58*tiorock is now known as rockcavera
14:19:32*firefall joined #nim
14:41:45FromDiscord<albassort> beef is there a way to write a macro that gets the params of the first porcedure in a block
14:49:21FromDiscord<fabric.input_output> how do you intend to use this macro?
14:51:06FromDiscord<nasuray> In reply to @albassort "beef is there a": There is absolutely a way to do this
14:52:32FromDiscord<albassort> In reply to @fabric.input_output "how do you intend": im thinking of schemes to profile my codebase
14:53:53FromDiscord<fabric.input_output> In reply to @albassort "im thinking of schemes": you got an example of how you're gonna use it? (code)
14:54:58*beholders_eye joined #nim
14:58:40FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=GALnmvbF
14:59:08FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=gNAchWfF" => "https://play.nim-lang.org/#pasty=eGhbIOWF"
14:59:25FromDiscord<albassort> or smth
14:59:34FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=qSYiKcaW" => "https://play.nim-lang.org/#pasty=CYAoXnJC"
15:00:10FromDiscord<fabric.input_output> yeah you can traverse the tree and find call nodes
15:00:44FromDiscord<fabric.input_output> definitely doable
15:01:11FromDiscord<albassort> ok but
15:01:14FromDiscord<albassort> is it a good idea?
15:08:15FromDiscord<fabric.input_output> doesn't seem like a bad one tbh
15:18:05FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=qpTwYBBk
15:18:26FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=BXCgLvHj
15:19:44FromDiscord<ambient3332> Also I tried some code ripped from mratsims work previously https://github.com/amb/aoc-nim/blob/master/tracer.nim
16:15:18*coldfeet quit (Quit: Lost terminal)
16:48:35*firefall quit (Remote host closed the connection)
18:12:26*xaltsc quit (Ping timeout: 265 seconds)
18:14:09*xaltsc joined #nim
18:23:41*thunder quit (Killed (NickServ (GHOST command used by metasintactic)))
18:23:41*metasintactic joined #nim
18:52:08*beholders_eye quit (Read error: Connection reset by peer)
18:57:55*beholders_eye joined #nim
19:16:38FromDiscord<jm_sts> sent a code paste, see https://play.nim-lang.org/#pasty=oTuspCYK
19:17:16FromDiscord<jm_sts> (edit) "https://play.nim-lang.org/#pasty=EHPpawvJ" => "https://play.nim-lang.org/#pasty=hiaeOXjz"
19:17:47FromDiscord<jm_sts> (edit) "https://play.nim-lang.org/#pasty=rUZBfQcU" => "https://play.nim-lang.org/#pasty=ktwUzRQJ"
19:17:48Amun-Rajm_sts: HomePageProps field title is private
19:17:57Amun-Rait's missing a star
19:18:09FromDiscord<jm_sts> oh i need to add stars to each member as well, okay
19:18:13Amun-Rayes
19:19:02FromDiscord<jm_sts> thats like nim 101, i totally forgot lol, thank you!
19:20:21Amun-Rahappens, no worries :P
19:27:37*ntat_ joined #nim
19:27:53*ntat quit (Ping timeout: 252 seconds)
19:32:05*xet7 joined #nim
19:36:50FromDiscord<albassort> do options get converted to NULL in postgres
19:36:51FromDiscord<albassort> i bet not
19:39:48FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=OAMdcYkY
19:41:21FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=GzXwaIYw
19:41:51FromDiscord<albassort> massive brain
19:57:16FromDiscord<tauruuuuuus> Has anyone ever tried to integrate a nim library into a c project using cmake? I have an existing cmake c project and I'd like to use a nim dependency
19:57:40FromDiscord<albassort> In reply to @tauruuuuuus "Has anyone ever tried": yes
19:58:14FromDiscord<albassort> im not a cmake master but i have 2 nim dependencies here
19:59:09FromDiscord<albassort> @tauruuuuuus https://git.dog/Caroline/miTTenS/src/branch/dev/CMakeLists.txt
20:07:28*beholders_eye quit (Ping timeout: 265 seconds)
20:37:00*ntat_ quit (Quit: Leaving)
20:38:28FromDiscord<System64 ~ Flandre Scarlet> Is using variants much faster than inheritence?
20:44:14FromDiscord<Elegantbeef> It doesn't introduce pointer indirection so it can be
20:52:55FromDiscord<albassort> what is a variant :eyE:
20:52:57FromDiscord<albassort> (edit) ":eyE:" => "👁️"
20:53:11FromDiscord<Elegantbeef> A tagged union
20:53:25FromDiscord<albassort> why not just call em that
20:54:18FromDiscord<Elegantbeef> Cause they are called object variants in Nim
21:05:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It doesn't introduce pointer": But now, I can't use methods and stuff like this↵And what if I want to store those variants into an array or a seq?
21:06:13FromDiscord<Elegantbeef> You make an array of them?
21:06:19FromDiscord<Elegantbeef> Like that's the entire point is that you can store them contiguously
21:06:34FromDiscord<System64 ~ Flandre Scarlet> I won't lose data?
21:08:25FromDiscord<System64 ~ Flandre Scarlet> and how can I split it into differents files?↵I can do this with inheritence
21:09:07FromDiscord<Elegantbeef> You don't with tagged unions
21:09:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You don't with tagged": Seems it's less practical for my case since I work by modules
21:10:44FromDiscord<Elegantbeef> Well tagged unions can represent an inheritance tree but it's more static and less adhoc than inheritance
21:10:51FromDiscord<Elegantbeef> Though technically single parent inheritance can be represented as a tagged union
21:13:37FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Though technically single": in this case I can quite easily adapt my work↵But I'll have a big switch statement then
21:13:51FromDiscord<Elegantbeef> Oh noes!
21:14:28FromDiscord<Elegantbeef> One benefit is that you always know that you're handling a type's function
21:14:44FromDiscord<Elegantbeef> Whereas with methods you might call the base implementation and need a runtime error to catch it
21:23:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "One benefit is that": That's true↵Btw I can probably use templates for splitting fields?
21:23:42FromDiscord<Elegantbeef> "splitting fields"
21:24:15FromDiscord<System64 ~ Flandre Scarlet> Yeah so I don't have a very long object in my declaration
21:24:39FromDiscord<Elegantbeef> Nope
21:25:11FromDiscord<System64 ~ Flandre Scarlet> Oh, bad idea?
21:26:02FromDiscord<Elegantbeef> Not possible
21:26:05FromDiscord<Elegantbeef> Use objects to break up the fields if you really want
21:27:08FromDiscord<System64 ~ Flandre Scarlet> Ah, I can do this!
21:27:43FromDiscord<System64 ~ Flandre Scarlet> Now is all of this worth? no idea
21:29:58FromDiscord<Elegantbeef> benchmarks and profiling are the only way to know
21:31:36FromDiscord<System64 ~ Flandre Scarlet> Now it will probably be harder to maintain (I have to modify the Case statements for each proc)
21:31:56FromDiscord<Elegantbeef> It'll give you a nice static error though
21:32:11FromDiscord<Elegantbeef> Though you can always do some macro confuckery
21:33:11FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It'll give you a": True, compile-time errors are frustrating, but still way better than runtime errors
21:33:49FromDiscord<System64 ~ Flandre Scarlet> but I'm still not a macro expert↵But I can still change the behavior later
21:47:40FromDiscord<dromedariodechapeu> https://play.nim-lang.org/#pasty=mdCJbvBc↵I'm trying to use generics, is there a way to use functions with generics, without setting the type with the`[type]` syntax? ↵https://nim-lang.org/docs/tut2.html#generics here the `[type]` is only used when creating the tree, but when i try to use functions with generic wihtout explicit setting the type the code not even compilers.
21:49:18FromDiscord<dromedariodechapeu> https://play.nim-lang.org/#pasty=mdCJbvBc↵Hello, I'm trying to use generics, is there a way to use functions with generics, without setting the type with the[type] syntax? ↵https://nim-lang.org/docs/tut2.html#generics here the [type] is only used when creating the tree, but when i try to use functions with generic wihtout explicit setting the type the code not even compilers.
21:50:29FromDiscord<Elegantbeef> `stack1.add(10)` works fine
21:51:32FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=NmlnZWcw
21:55:03FromDiscord<dromedariodechapeu> sent a code paste, see https://play.nim-lang.org/#pasty=hAtnsGUZ
21:55:35FromDiscord<Elegantbeef> @System64 ~ Flandre Scarlet https://github.com/beef331/nimtrest/wiki/Code-snippets#more-intuitive-variant-dispatching Since your problem tickled my brain
21:56:32FromDiscord<Elegantbeef> Fun tooling problems!
21:56:51FromDiscord<dromedariodechapeu> In reply to @dromedariodechapeu "VS Code is showing": i try to find what is `system.in` and why is different from a `int literal`, but could find anything
21:57:45FromDiscord<Elegantbeef> A int literal is just an untyped int
22:02:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "<@380360389377916939> https://github.com/beef331/ni": Oh, many interesting stuff!
22:03:01FromDiscord<System64 ~ Flandre Scarlet> Thanks for this! Will be pretty useful!
22:03:47FromDiscord<System64 ~ Flandre Scarlet> Btw, can int24 be useful for something?
22:04:28*rockcavera quit (Ping timeout: 252 seconds)
22:04:36FromDiscord<Elegantbeef> Nim does not have 24bit ints
22:05:18FromDiscord<System64 ~ Flandre Scarlet> But what are they useful for?
22:05:59FromDiscord<Elegantbeef> systems with 24bit registers or if you want to reduce the amount of data stored contigously
22:06:12FromDiscord<Elegantbeef> Though on most systems they're likely 32bits unless you do it all in software
22:06:17FromDiscord<System64 ~ Flandre Scarlet> Oh alright
22:12:31FromDiscord<dawidek.2137> is there a better way to have hot reloading than separating program into executable and dll?
22:13:13FromDiscord<Elegantbeef> Not particularly if you want a compiled language
22:13:27FromDiscord<Elegantbeef> My library potato doesn't rely on the Nim HCR and allows you not to split the main module up
22:17:15*beholders_eye joined #nim
22:22:21FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#pasty=GJlLslGW
22:23:27FromDiscord<Elegantbeef> doing `result = typeSection` maay resolve it
22:26:31FromDiscord<luteva> In reply to @Elegantbeef "doing `result = typeSection`": thanks, but the error is the same: "Error: 'export' is only allowed at top level"
22:26:50FromDiscord<Elegantbeef> Can you provide a full usage example
22:27:43FromDiscord<Elegantbeef> Oh wait are you using this inside like `suite` or `test`?
22:27:50FromDiscord<luteva> yes!
22:28:06FromDiscord<Elegantbeef> Well there's your problem
22:28:23FromDiscord<luteva> suite "NewType Macro Tests":↵ test "can create a simple type":↵ createType(SimpleUser, name: string)↵.....
22:28:42FromDiscord<luteva> ok so. the problem is the suite scope?
22:28:45FromDiscord<Elegantbeef> Yea that's not going to work since it exports inside a template
22:29:00FromDiscord<Elegantbeef> It's going to expand to non root code
22:29:22FromDiscord<luteva> yes, ok. i got it! Thanks!
22:29:49FromDiscord<luteva> any simple solution to work around that?
22:30:42FromDiscord<luteva> remove the suite and just run all of the tests without a suite? or what is the way to go here?
22:32:29FromDiscord<Elegantbeef> Put it in another macro to detect if it's at top level somehow
22:36:33FromDiscord<Elegantbeef> This used to work, but I think `owner` has been removed https://github.com/beef331/nimtrest/wiki/Code-snippets#check-if-top-level
22:37:59FromDiscord<luteva> ok, but it still won't work if it is not at top level, right? So maybe it is best to let the compiler complain here and stop compiling, as it won't work anyway, right? Or is there a way to make it work?
22:38:19FromDiscord<Elegantbeef> Up to you what you do
22:38:31FromDiscord<Elegantbeef> You could detect top level and remove the `` or you can leave it as is
22:38:33FromDiscord<luteva> thx!!
22:38:43FromDiscord<Elegantbeef> Hopefully you're just writing this macro to learn and not actually use it
22:41:44FromDiscord<luteva> why? Is there something wrong? I mean i want to write a dsl that generates nim types from parsed code....↵(This is not to generate types from some network/IO/Internet calls are something like this.)
22:42:23FromDiscord<Elegantbeef> parsed code?
22:43:27FromDiscord<luteva> parsed dsl-code. so the dev writes some code in a domain specifc language and this code gets compiled. so i need to generate nim types.
22:44:02FromDiscord<Robyn [She/Her]> In reply to @luteva "parsed dsl-code. so the": In that case your macro should already be handling all the parsing and making the fields as needed, no?
22:44:28FromDiscord<Elegantbeef> If it fits your needs use it, but that macro itself isn't much better than just writing a normal Nim type
22:46:47FromDiscord<luteva> In reply to @Elegantbeef "If it fits your": if you can choose nim as a (dsl) language i am totally fine! But the dsl is already defined, the code exists. so i have to deal with how the code is written. write a parser and generate nim types from the AST.
22:47:17FromDiscord<luteva> (edit) "In reply to @Elegantbeef "If it fits your": if you can choose nim as a (dsl) language i am totally fine! But the dsl is already defined, the code exists. so i have to deal with how the code is written. write a parser and generate nim types ... from" added "procs etc."
22:47:46FromDiscord<luteva> (edit) "In reply to @Elegantbeef "If it fits your": if you can choose nim as a (dsl) language i am totally fine! But the dsl is already defined, the code exists. so i have to deal with how the code is written. write a parser and generate nim types ... procs" added "and"
22:52:16FromDiscord<luteva> I also have a 'basic version' that generates the nim source code from the AST. But having a macro that just gets the type name and fields/properties and there types etc. is much easier. (at least for me 😄 )
22:57:14FromDiscord<luteva> In reply to @battery.acid.bubblegum "In that case your": that is what i was trying to do: the macro is being called by an AST visitor (or a listener or something similar). so the macro "createType" should set the fields and there visibility.↵Not sure if this is what you wanted to say?!?!
22:58:30FromDiscord<luteva> (edit) "there" => "their"
23:04:09FromDiscord<Robyn [She/Her]> ah okay then, that makes sense i believe
23:25:36*beholders_eye quit (Ping timeout: 252 seconds)