<< 25-06-2021 >>

00:11:22*xet7 quit (Read error: Connection reset by peer)
00:11:36*xet7 joined #nim
00:18:27*Gustavo6046_ joined #nim
00:19:12*vicfred quit (Quit: Leaving)
00:19:21*Gustavo6046 quit (Ping timeout: 256 seconds)
00:20:50*Gustavo6046_ is now known as Gustavo6046
01:00:49*kasperk81 quit (Quit: Connection closed)
01:01:59*petrj quit (Quit: Connection closed)
01:08:25*lain joined #nim
01:40:54*arkurious quit (Quit: Leaving)
01:44:00FromDiscord<Rika> In reply to @dom96 "`obj.field = 42` is": And then if the object has both a field and a function but the field is unexported lol
01:44:11FromDiscord<Rika> Inside the module, it's the field, outside, it's the function
02:18:34FromDiscord<deech> Semantically what's the difference between `type MyInt = object i: int` and `type MyInt = distinct int`?
02:19:43FromDiscord<Elegantbeef> You cannot borrow procedures from the int in this case, nor can you easily convert a `MyInt` to `int` without a converter
02:20:59FromDiscord<deech> Can the latter have distinct lifecycle hooks, `=sink`, `=copy` etc?
02:21:58FromDiscord<Elegantbeef> !eval type A = distinct int; proc `=sink`(a\: var A, y\: A) = discard
02:21:59NimBotCompile failed: /usercode/in.nim(1, 44) Error: expected: ')', but got: 'keyword var'
02:22:06FromDiscord<Elegantbeef> Oh shit that's not going to work is it? \:D
02:22:15FromDiscord<Elegantbeef> To answer your question it can i believe
02:23:46FromDiscord<deech> Interesting! Then why would I ever want an object with one field as opposed to a `distinct` type? That seems like a better design choice in general?
02:23:52FromDiscord<Elegantbeef> Yea the docs say `T can also be a distinct type`
02:24:05FromDiscord<Elegantbeef> You wouldnt
02:24:38FromDiscord<deech> I suppose `distinct` can't be parameterized? eg. `type MySeq[T] = distinct seq[T]`?
02:25:05FromDiscord<Elegantbeef> Had someone making a generic collection yesterday
02:25:34FromDiscord<Elegantbeef> It works but dont expect to borrow `[]` `[]=` as they work on generics so are not concrete
02:26:31FromDiscord<deech> Yeah good point. It still seems that for concrete types `distinct` is always a better choice vs. a single field `object.`.
02:27:36FromDiscord<Elegantbeef> But in that case get close with the ufcs generic syntax to make your life easier
02:27:47FromDiscord<Elegantbeef> `proc add[T](a: var A[T], val: sink T) = a.seq[:T].add(val)` just slides of the tongue
02:28:18FromDiscord<deech> whoa, what does `a.seq[:T]` do?
02:28:18FromDiscord<Elegantbeef> Distincts converted to their base are l values which means things like that works
02:28:34FromDiscord<Elegantbeef> It converts it back to a seq and runs the add operation on that
02:28:53FromDiscord<Elegantbeef> It's the same as `seq[T](a).add` just with ufcs for type conversion
02:29:10FromDiscord<Elegantbeef> In ufcs generic calls you have to do `: T` to pass the generic along
02:29:23FromDiscord<deech> Ah! I didn't know that.
02:29:28FromDiscord<Elegantbeef> Otherwise it's taken as a indexing by type and doesnt work unless that's what you want
02:31:11FromDiscord<Elegantbeef> To highlight that note though, it's another benefit for the distinct, since you can call base operations on the type if they expect a mutable version without any converters or anything
02:33:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3r2M
03:09:10FromDiscord<hamidb80> what is {.anchor.}?
03:09:16FromDiscord<hamidb80> i coudn't find doc about it
03:09:35FromDiscord<hamidb80> (edit) "{.anchor.}?" => "`{.anchor.}`?"
03:10:26FromDiscord<hamidb80> also what is `{.dirty.}`?
03:11:51FromDiscord<hamidb80> are they documented?
03:15:55FromDiscord<Elegantbeef> Dirty is for making a template unhygenic so it doesnt gensym symbols internally
03:17:23FromDiscord<Elegantbeef> Never seen `anchor` before
03:22:02*Epsilon quit (Ping timeout: 244 seconds)
03:24:00FromDiscord<hamidb80> tnks
03:24:16*Epsilon joined #nim
03:26:29FromDiscord<kaushalmodi> In reply to @hamidb80 "also what is `{.dirty.}`?": https://nim-lang.github.io/Nim/manual#templates-hygiene-in-templates
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:37*supakeen joined #nim
04:08:22FromDiscord<checkersai> Can I get some input on an idea?
04:08:58FromDiscord<checkersai> I was wondering if it might be a fun exercise to port the quake engine to Nim
04:11:56FromDiscord<Elegantbeef> it'd probably be a fun exercise, but you're after all just re-implementing an already existing thing so if you find that worthwhile is the question you should ask
04:12:47FromDiscord<checkersai> fair enough
04:12:57FromDiscord<checkersai> What if I tried to make a quake-like engine in Nim?
04:13:24FromDiscord<Elegantbeef> You're presently talking to someone who is making a voxel rendering engine in Nim for fun, so.... \:P
04:13:39FromDiscord<checkersai> oh cool
04:14:23FromDiscord<Varriount> Is there some new flag required to get line numbers in stack traces? I have a program that is throwing an exception, and no matter what flags I do or do not use (`linetrace`, `stacktrace`, `linedir`, `debugger`, etc.) nothing seems to get line numbers working properly.
04:15:30FromDiscord<checkersai> In reply to @Elegantbeef "You're presently talking to": I mainly got interested because I was just playing the Hrot demo
04:15:44FromDiscord<checkersai> and the developer of that wrote a custom engine in Pascal
04:16:28FromDiscord<checkersai> I just spent like 20 minutes in the demo just looking at everything. Not even playing through it just observing the models and shading and stuff
04:16:43FromDiscord<checkersai> And I thought "I wonder if I can do something like this"
04:16:44FromDiscord<Elegantbeef> Yea i mean it's completely doable, really a question of "is it something you want to dedicate a buttload of time into"
04:16:55FromDiscord<Elegantbeef> If you dont know much about game engines it'd teach you a fair bit
04:17:27FromDiscord<checkersai> I know a tiny bit
04:18:18FromDiscord<checkersai> Like I've dabbled in rendering stuff
04:18:27FromDiscord<checkersai> but I've never written a whole game engine
04:18:33FromDiscord<checkersai> (edit) "Like I've dabbled in ... rendering" added "basic"
04:19:02fn<ForumUpdaterBot> New Nimble package! chain - Nim's function chaining and method cascading, see https://github.com/khchen/chain
04:19:03fn<R2D2> itHub: 7"Nim's function chaining and method cascading"
04:19:48*SebastianM joined #nim
04:20:41FromDiscord<Elegantbeef> Well if you're interested in doing it there is not much reason not to unless you have other stuff you want to do πŸ˜›
04:21:17FromDiscord<Elegantbeef> Just dont make a "quake engine" make a game of your own and have it play similarly to quake πŸ˜€
04:26:45FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3r31
04:26:56FromDiscord<hamidb80> > Error: invalid token: _ (\95)
04:27:36FromDiscord<hamidb80> even in ` back ticks
04:27:40FromDiscord<hamidb80> (edit) "in" => "inside"
04:27:48FromDiscord<Elegantbeef> Well `_` is an invalid start character
04:28:51FromDiscord<kaushalmodi> In reply to @hamidb80 "i cant define variable": https://nim-lang.github.io/Nim/manual#lexical-analysis-identifiers-amp-keywords↡↡> letter ::= 'A'..'Z' | 'a'..'z' | '\x80'..'\xff'
04:29:23FromDiscord<Elegantbeef> even without that in mind, `_name` would have to be a valid way to interact with that variable
04:31:08FromDiscord<Elegantbeef> I say would have to, but that's just cause `\`name\`` can be accessed`name\`
04:31:15FromDiscord<Elegantbeef> oh jeez there goes highlighting
04:31:26FromDiscord<kaushalmodi> In reply to @Elegantbeef "even without that in": Nim allows unicodes in identifiers, but looking at that spec, those have to be within those hex values? And the hex value of `_` is 0x5F.
04:31:56FromDiscord<kaushalmodi> checking if markdown-like double back-quoting works.. `` `abc` ``
04:32:42FromDiscord<Elegantbeef> Anywho why are we starting variables with `_` this isnt C# or python πŸ˜›
04:32:47FromDiscord<kaushalmodi> yep.. that's `BB BabcB BB` where B is a backquote
04:33:47FromDiscord<hamidb80> In reply to @Elegantbeef "Anywho why are we": i wanna make a client for arangoDB and Arango has fields `_key`, `_id` and `_rev` by defauly
04:33:53FromDiscord<hamidb80> (edit) "defauly" => "default"
04:34:28FromDiscord<hamidb80> i think i can use \key , \id , ... instead
04:34:47FromDiscord<Elegantbeef> Why make it harder on yourself?
04:35:24FromDiscord<hamidb80> πŸ˜„
04:35:32FromDiscord<hamidb80> youre right
04:35:35FromDiscord<hamidb80> (edit) "youre" => "you're"
04:36:11FromDiscord<Elegantbeef> Like why not just use `key`, `id`, `rev` then on conversion add the `_` or even use metaprogramming to control the conversion
04:37:17FromDiscord<hamidb80> that's a good idea
04:40:23FromDiscord<checkersai> @ElegantBeef is your voxel engine on github?
04:40:41FromDiscord<Elegantbeef> It is but it's absolutely useless atm
04:40:51FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/857842755845488640/image.png
04:40:57FromDiscord<Elegantbeef> Unless that grid really makes you happy
04:43:00FromDiscord<Elegantbeef> That's a 4x4 raymarched grid, so.... yea
04:45:03FromDiscord<checkersai> ah
05:03:10*SebastianM quit (Quit: Bye)
05:19:09FromDiscord<checkersai> Can I specify what garbage collector to use in the `.nimble` file?
05:19:27FromDiscord<Elegantbeef> should be `switch("gc", "orc")` for instance
05:24:18FromDiscord<checkersai> thanks
05:25:38*rockcavera quit (Remote host closed the connection)
05:25:39FromDiscord<checkersai> Also, `GC_step` only works for gc:refc, right?
05:30:10*cyraxjoe joined #nim
05:44:02FromDiscord<Phytolizer> can someone review this code and let me know if i am doing Terrible Awful Things? it's probably a lot to ask but i really want to improve my Nim↡https://github.com/onContentStop/crenshaw.nim
05:44:04fn<R2D2> itHub: 7"<No Description>"
05:44:34FromDiscord<Phytolizer> the big mama is in `tiny.nim`
05:45:10FromDiscord<Phytolizer> it's a programming language compiler.
05:46:45FromDiscord<Elegantbeef> I see PascalCased procedures
05:48:14FromDiscord<Phytolizer> yes, this is based on a chunk of Pascal code
05:48:31FromDiscord<Phytolizer> is that bad style?
05:48:48FromDiscord<Elegantbeef> Nim conventions are camelCased for procedures
05:49:16FromDiscord<Elegantbeef> `GetNum` returning `char` is a bit odd
05:49:50FromDiscord<Phytolizer> it returns `int` in `tiny.nim`, the other files are prototypes of that compiler
05:50:15FromDiscord<Phytolizer> sorry for the confusion
05:50:31FromDiscord<Elegantbeef> Ah checkout strutils/parseutils you're reimpl alot of logic
05:51:19FromDiscord<Phytolizer> never heard of `parseutils`, will check it out
05:51:26FromDiscord<Phytolizer> i have a feeling this compiler could be a lot smaller
05:52:16FromDiscord<haxscramper> In reply to @Phytolizer "can someone review this": Also use `import std/[...]` for imports
05:52:27FromDiscord<Phytolizer> oh really? why?
05:52:48FromDiscord<Phytolizer> absolute vs relative path specification i guess?
05:53:51FromDiscord<haxscramper> No, just better to use `std/` prefix when importing std modules
05:54:01FromDiscord<haxscramper> Btw, are you following some tutorial?
05:54:09FromDiscord<Phytolizer> yes, i'll link it
05:54:20FromDiscord<Phytolizer> it's from 1985 but has been really helpful for me
05:54:27FromDiscord<Phytolizer> https://compilers.iecc.com/crenshaw
05:55:11FromDiscord<Phytolizer> something i haven't paid much mind to yet is that back then there were a LOT less convenience functions and you had to DIY
05:55:18FromDiscord<Phytolizer> that's why there's a lot of reinventing the wheel here
05:56:34FromDiscord<haxscramper> https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6 if you are interested in the collection of links for language development in nim
05:56:44FromDiscord<haxscramper> I also added your project tot he list because it looks very interesting
05:57:11FromDiscord<Phytolizer> hey, thanks! :)
05:57:17FromDiscord<Phytolizer> that looks like a really good list
05:57:27FromDiscord<Elegantbeef> But yea strutils has stuff for almost all `isX`
05:58:14FromDiscord<Phytolizer> not just IsAlpha/Digit/AlNum?
05:58:43FromDiscord<Phytolizer> IsWhite specifically excludes newlines because there is control over where that is allowed in the language
05:59:08FromDiscord<Elegantbeef> https://nim-lang.org/docs/strutils.html#isAlphaNumeric%2Cchar
05:59:52FromDiscord<Elegantbeef> Most of that stuff is nearby
06:04:11*PMunch joined #nim
06:05:55FromDiscord<Elegantbeef> I dont know what the general view is but for atleast some of those emitted calls you could use templates as such to reduce the chance of a typo https://play.nim-lang.org/#ix=3r3p \:D
06:06:48FromDiscord<Phytolizer> templates are like C macros right?
06:07:06FromDiscord<Phytolizer> just a cut-and-paste thing?
06:07:10FromDiscord<Elegantbeef> They're code substitution, they're slightly similar
06:07:22FromDiscord<Elegantbeef> They can have typed parameters for type safety
06:07:38FromDiscord<Phytolizer> ok, templates are definitely not a bad idea as this code has some repetition
06:08:26FromDiscord<Elegantbeef> Also no clue if you want more safety but i'd do this a bit different πŸ˜€
06:08:35FromDiscord<Phytolizer> how so?
06:08:47FromDiscord<Phytolizer> btw if you refresh the page, i fixed the casing for all the procs
06:09:02FromDiscord<Phytolizer> i am interested in making this code safer/easier to debug
06:09:32FromDiscord<Elegantbeef> Have all the registers be enums then have for instance `proc push(r: Register)`
06:09:33FromDiscord<Elegantbeef> then your code would be almost identical to the asm
06:10:01FromDiscord<Phytolizer> i see
06:10:41FromDiscord<Phytolizer> most of the code deals in rax/rbx though, wouldn't it make more sense to make the opcode be the parameter?
06:10:57FromDiscord<Phytolizer> exception being div because div is annoying in x64 apparently
06:11:02FromDiscord<Elegantbeef> That'd be valid nim code πŸ˜›
06:11:02FromDiscord<Elegantbeef> Well `cdq()`
06:11:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3r3r
06:11:15FromDiscord<Phytolizer> ah that's clever
06:11:29FromDiscord<checkersai> Just curious, is there a function or flag in nim that says which gc is being used currently? Like could I do something like `echo currentGC`
06:12:25FromDiscord<Elegantbeef> There is a way to fetch compiler options but i never remember how, sorry
06:13:53FromDiscord<Elegantbeef> No clue if you like my idea, but i think it's nicer than writing strings manually πŸ˜›
06:14:16FromDiscord<Phytolizer> i'm not 100% sold, it would feel like a gimmick to me
06:14:44FromDiscord<Elegantbeef> Yea i mean it's mostly just about if you're adding any more operations
06:15:12fn<hoijui> I have small tool which runs a series of checks. each check is defined in its own nim source file, and has the same structure (simplified, it contains a: `proc run()`)
06:15:13fn<hoijui> each such Nim source file is in the "checks" sub-dir
06:15:21fn<hoijui> in the main source file, I manually import each of these files, and later execute the `run` method from it.
06:15:28fn<hoijui> is it possible to somehow automate the importing of all the checks ("checks/*.nim"), and get a list of them, so I can execute their `run` procs in a loop?
06:15:46FromDiscord<Elegantbeef> You could use a macro to import all the files in that folder
06:15:50fn<hoijui> something like.. "compile-time plugins"
06:15:50FromDiscord<Phytolizer> fair enough. i haven't finished the tutorial but it doesn't seem like he's going to add more
06:16:06fn<hoijui> Elegantbeef, ok!
06:16:12FromDiscord<Elegantbeef> https://github.com/GaryM-exkage/GDGW-Maverick-Bot/blob/master/src/nimcordbot/utils.nim#L3 might be useful for you
06:16:40FromDiscord<Phytolizer> god i love nim macros
06:16:41FromDiscord<Elegantbeef> That handles the importing of the given relative folder path, you then would also emit a `moduleX.run()`
06:16:56FromDiscord<Elegantbeef> Join the club, they solve so many issues
06:17:42*lucerne joined #nim
06:18:45FromDiscord<Elegantbeef> Feel free to ask for help if you need it modifying that macro
06:20:34fn<hoijui> Elegantbeef.. coool! thank you! :-)
06:21:07fn<ForumUpdaterBot> New post on r/nim by totallyspis: Fetch compiler options in code, see https://reddit.com/r/nim/comments/o7hxsn/fetch_compiler_options_in_code/
06:21:13fn<hoijui> I think I'll need help for the "emit a `moduleX.run()`" part
06:21:55fn<hoijui> hm.. I geus it should be a separate macro, as I'll run that in a different place, right?
06:22:10fn<hoijui> guess*
06:29:44FromDiscord<Phytolizer> thanks for looking over my code Elegantbeef, i really appreciate having fresh eyes on it
06:34:28*xbello joined #nim
06:35:10FromDiscord<Elegantbeef> Yea you can use either the macro cache or some other variable for storing module names
06:35:47*xbello quit (Client Quit)
06:49:14PMunchHmm, what would be the easiest way to have an interactive curve thing. Something like this: https://www.theinsidetips.com/wp-content/uploads/2020/04/Curves_01.jpg
06:57:44PMunchHmm, looks like I might need to write this myself in SDL or something..
07:12:17fn<hoijui> Elegantbeef, got it working! wow.. it looked har at first but was surprisingly easy! thank you!
07:12:31FromDiscord<Elegantbeef> No problem!
07:12:33fn<hoijui> never used macros before
07:12:47fn<hoijui> :-)
07:13:31fn<hoijui> luckily I fond some macro tutorial that mentioned `dumpTree()`, which was essential for figuring things out
07:21:24FromDiscord<Elegantbeef> Yea it's very useful for solving macro woes
07:21:51FromDiscord<Elegantbeef> `treeRepr`, `dumpTree`, and `repr` are very very useful for debugging/reasoning around macros
07:28:52PMunchhoijui, that wouldn't happen to be my tutorial would it?
07:29:02FromDiscord<Elegantbeef> Hope it's mine
07:29:10FromDiscord<Elegantbeef> It's certainly not mine πŸ˜›
07:29:22PMunchDo you have a macros tutorial?
07:29:52FromDiscord<Elegantbeef> I have the one write up but nothing much
07:33:12*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
07:37:20fn<hoijui> it was this tutorial/example: https://nim-lang.org/blog/2018/06/07/create-a-simple-macro.html
07:41:56fn<hoijui> i did a web-search, opened 5 links , and looked at just one of them, so it was a quite random choice
07:42:39fn<hoijui> is there a macro that takes code as argument, and outputs the source code of a macro that generates that code?
07:43:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#quote%2Ctyped%2Cstring
07:43:32FromDiscord<Elegantbeef> Let's you write macros akin to templates
07:43:36fn<hoijui> all by itsself it woudl not be very useful of course, but it could form a base for a macro, where one just needs to replace some static strings with paramters, and adding a loop here and there
07:43:44fn<hoijui> ok ...
07:46:58FromDiscord<Elegantbeef> Atleast i think that's what you mean
07:47:14FromDiscord<Elegantbeef> There is also the `astgenrepr`
07:48:03fn<hoijui> Elegantbeef, I think it is not what I mean
07:48:03PMunchYeah astGenRepr sounds more like what they asked for
07:48:15fn<hoijui> looking at `astgenrepr` now ...
07:48:54*max22- joined #nim
07:50:18*Schnouki quit (Quit: WeeChat 3.2)
07:55:08fn<hoijui> I think, `astgenrepr` is almost what I mean, but I would have to prepare the arguemnt somehow..
07:56:00fn<hoijui> what I want is this (I think): `echo astgenrep(someProc(let i = 3))`
07:56:25FromDiscord<Elegantbeef> Dont quite follow
08:00:31PMunchWell astGenRepr is more intended to see what you need to write to create a macro, and then copy that into your program
08:03:52fn<hoijui> `dumpTree(check(registry, runState))` -> Call
08:03:52fn<hoijui> Ident "check"
08:03:53fn<hoijui> Ident "registry"
08:03:53fn<hoijui> Ident "runState"
08:03:57fn<hoijui> `astGenRep(check(registry, runState))` ->
08:03:57fn<hoijui> macro NAME*(): untyped =
08:03:57fn<hoijui> newStmtList(
08:03:58fn<hoijui> newNimNode(nnkCode).add(
08:04:00fn<hoijui> ident("check"),
08:04:02fn<hoijui> ident("registry"),
08:04:04fn<hoijui> ident("runState"),
08:04:06fn<hoijui> ),
08:04:08fn<hoijui> )
08:04:10fn<hoijui> the first one works
08:04:15fn<hoijui> the second one is what I would want
08:04:15PMunchPlease don't paste data into IRC
08:04:20fn<hoijui> (more or less)
08:04:26PMunchIt spams the channel quite abit
08:04:34fn<hoijui> :/ sorry
08:04:41fn<hoijui> pastebin
08:04:50FromDiscord<Elegantbeef> Or nim playground πŸ˜›
08:05:04FromDiscord<Elegantbeef> I dont see the point templates already give you this
08:06:34FromDiscord<mantielero (mantielero)> Hi all. Quick question.
08:06:59FromDiscord<mantielero (mantielero)> I am wrapping a CPP method with\: `proc typeName(this:Mx): string {.importcpp: "#.type_name()".}`
08:07:16FromDiscord<Elegantbeef> Like this seems similar to what you want hoijui https://play.nim-lang.org/#ix=3r3X
08:07:24FromDiscord<mantielero (mantielero)> and I am gettig the error\: error\: cannot convert β€˜std\:\:string’ {aka β€˜std\:\:\_\_cxx11\:\:basic\_string\<char\>’} to β€˜void\’
08:07:56FromDiscord<Elegantbeef> well string is Nim's string, so the CPP method is almost certainly not going to return that
08:08:04PMunchNim `string` is certainly not compatible with whatever C++ strings are
08:08:18PMunchYou probably want it to return `cstring` instead
08:08:18FromDiscord<mantielero (mantielero)> I have tried `cstring`as well
08:08:56PMunchAnd what did that give you?
08:09:49FromDiscord<mantielero (mantielero)> sent a long message, see http://ix.io/3r3Y
08:10:21FromDiscord<mantielero (mantielero)> It works with the type\: `CppString {.importcpp: "std::string", header: "<string>", byref.} = object`
08:10:55*saem[m] joined #nim
08:11:08FromDiscord<mantielero (mantielero)> But I was expecting using `cstring`. I tried `string`because that was what c2nim gave me.
08:12:36FromDiscord<mantielero (mantielero)> The line that I am wrappin\: https://github.com/casadi/casadi/blob/12fa60f676716ae09aa2abe34c1c9b9cf426e68a/casadi/core/mx.hpp#L84
08:36:03fn<hoijui> Elegantbeef, I am not sure I understand what this does, but I am almost certain it is not what I want.
08:36:50fn<hoijui> I want to have macro code (as string) that generates an AST that does the same like the code I supplied
08:37:09fn<hoijui> in itsself, that is not useful, as you could just.. write the code directly
08:37:24fn<hoijui> but you can then use this macro code as a base, and start modularizing it
08:37:49fn<hoijui> so it basically just automates part of the macro-writing process
08:38:52FromDiscord<haxscramper> You need to `importcpp` `std::string` as well
08:39:04fn<hoijui> instead of dumpTree, one would use this macro instead, so adding "nkk" in front of things, and putting `newNimNode` in between and so on, would not have to be done manually
08:39:09FromDiscord<haxscramper> There is a wrapper for some C++ stdlib parts actually, so you can use this
08:39:34FromDiscord<haxscramper> https://github.com/sinkingsugar/nimline or https://github.com/Clonkk/nim-cppstl
08:39:36fn<R2D2> itHub: 7"Wrapper-less C/C++ interop for Nim"
08:39:49FromDiscord<haxscramper> First also has a lot of helper stuff for wrapping C++ code
08:40:10PMunchSounds a lot like `quote do` to me hoijui, or possibly something from macroutils
08:40:52FromDiscord<mantielero (mantielero)> I tried\: https://github.com/Clonkk/nim-cppstl/blob/49399f79c2a6bfed132f9fe71dea280e10dd4899/cppstl/std_string.nim#L126
08:41:16FromDiscord<mantielero (mantielero)> Everything compiles fine, but I cannot see the result
08:41:44fn<hoijui> yeah.. I am sure it already exists. I think astgenrep is pretty close
08:42:09fn<hoijui> it just won;t take code as input, but wants NimNode
08:42:44FromDiscord<Elegantbeef> `parsestmt` and `parseExpr` also might be what you want
08:42:55FromDiscord<Elegantbeef> I'm a little loss so just throwing stuff and seeing what sticks \:D
08:43:57FromDiscord<haxscramper> > ↡> cannot see the result↡> Nothing is returned on the nim side?↡>
08:44:09FromDiscord<haxscramper> > cannot see the result↡Nothing is returned on the nim side?
08:44:24FromDiscord<mantielero (mantielero)> I just get\: ""
08:44:52FromDiscord<mantielero (mantielero)> The cpp code is `static std::string type_name() {return "MX";}`
08:45:08FromDiscord<mantielero (mantielero)> I don't know why I don't get "MX".
08:45:25FromDiscord<mantielero (mantielero)> And why `cstring` is not working.
08:46:12FromDiscord<haxscramper> Because `cstring` is not an `std::string`
08:46:43FromDiscord<haxscramper> And you are wrapping static method, I think you need to use `importcpp: "class::staticMethod()` instead
08:47:11FromDiscord<mantielero (mantielero)> What is `cstring` in CPP context?
08:47:26FromDiscord<mantielero (mantielero)> Or is it only for the C backend?
08:48:03fn<hoijui> Elegantbeef, the parse* procs are .. I think also close, but they take string as input instead of code
08:48:09FromDiscord<haxscramper> `cstring` is a `char`
08:48:09FromDiscord<haxscramper> For both C++ and C
08:48:39fn<hoijui> is htere no proc that takes code as input and returns a NimNode for that code?
08:48:49FromDiscord<haxscramper> `std::string` is a C++ stdlib-only class so that is not universally used in the C++, so it makes no sense to work with it by default
08:49:03FromDiscord<mantielero (mantielero)> Understood
08:49:11FromDiscord<Rika> hoijui didnt someone already say to look at `quote` in the `macros` module
08:49:18FromDiscord<mantielero (mantielero)> I tried\: `proc typeName(this:Mx): CppString {.importcpp: "casadi::MX::type_name()".} # cdecl,`
08:49:37FromDiscord<mantielero (mantielero)> Compiles, but I get an empty string
08:51:18FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3r49
08:51:21FromDiscord<haxscramper> Works fine
08:51:51FromDiscord<haxscramper> I should've used `StdString` for the name instead of `CString` to avoid confusion though
08:52:14fn<hoijui> Rika, ahaa.. not I got it! :D yeap thanks!
08:52:41fn<hoijui> `static: echo astGenRepr(quote do: check(registry, runState))`
08:52:46fn<hoijui> this works!
08:53:05FromDiscord<Elegantbeef> So ignore me is what we're doing today hoijui πŸ˜€
08:53:17FromDiscord<haxscramper> idk why `cpp-stl` does `const_cast<char> on the `c\_str()\` results, but I suppose this is unrelated
08:54:09fn<hoijui> :D :D Elegantbeef, sorry! I was looking at quote as something that does what I want, but it just does the preparation step .. I could not see it fitting
08:54:10FromDiscord<haxscramper> > ↡> const\_cast makes it possible to form a reference or pointer to non-const type that is actually referring to a const object or a reference or pointer to non-volatile type that is actually referring to a volatile object. Modifying a const object through a non-const access path and referring to a volatile object through a non-volatile glvalue results in undefined behavior.↡>
08:54:11FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=3r4a
08:54:22FromDiscord<Elegantbeef> Lol it's fine
08:54:32FromDiscord<haxscramper> Most likely it is to avoid compilation errors on the nim side, since it might be the only option
08:54:43FromDiscord<haxscramper> As nim does not have type-level immutability
08:55:03fn<hoijui> :-)
08:55:04FromDiscord<Rika> lets all ignore beef lmaooooo
08:55:07FromDiscord<haxscramper> So it is either UB or `const_cast`
08:55:21FromDiscord<Elegantbeef> Wait you dont ignore me rika?
08:55:43FromDiscord<Rika> i said "lets all ignore" implying im inviting everyone else to do so
08:56:07FromDiscord<Elegantbeef> I tricked you into responding to me, you failed!
08:56:45FromDiscord<Rika> funny
08:56:46FromDiscord<Rika> i laughed
09:09:29PMunch@hoijui, you can also have a look at dumpAstGen which does the same as your code
09:10:28fn<Prestige> what's up hoijui :) nice to see you here
09:10:51fn<hoijui> Prestige, hey.. who are you? :D
09:11:15fn<Prestige> just another irc user in this chat haha. I also wrote the relay bot, working on nick colors now..
09:11:53fn<Prestige> oh and also wrote R2D2, can !eval code with it. I wonder if that'll conflict with the bot on libera
09:12:19fn<hoijui> PMunch, indeed! :-) same thing! (just the generated symbol names differ, which makes no difference)
09:12:54fn<Prestige> PMunch: can you !eval some code on your end for me?
09:13:07PMunch!eval echo "Hello Prestige"
09:13:08fn<hoijui> ah.. I though we know each other from somewhere else, Prestige
09:13:10NimBotHello Prestige
09:13:10fn<R2D2> Hello Prestige
09:13:21fn<Prestige> aha
09:13:28fn<Prestige> I should change that for this channel
09:13:44FromDiscord<Elegantbeef> Nah it's a feature
09:13:45FromDiscord<Elegantbeef> Double speak!
09:14:37FromDiscord<Elegantbeef> I think that's what orwell meant atleast
09:14:42fn<hoijui> ahh the relay bot.. nice! :-) what tech is the original chat made of?
09:15:34FromDiscord<Elegantbeef> I think most of the normal chat is biotic, might be a few NPCs about
09:15:35fn<Prestige> They're on discord and another irc network, I think also on matrix still?
09:16:07*max22- quit (Ping timeout: 246 seconds)
09:16:50FromDiscord<Elegantbeef> There are many bridges, but we dont cross them cause they're heavily guarded
09:17:13FromDiscord<Elegantbeef> \I just hope atleast one person gets the SG1 reference
09:19:45PMunchDid the bridge to Freenode die?
09:19:54fn<hoijui> :D
09:20:05fn<Prestige> *crickets*
09:20:06fn<hoijui> I am on freenode, and I think Prestige too
09:20:10FromDiscord<Elegantbeef> When they killed freenode it did, if that's what you mean
09:20:27FromDiscord<Elegantbeef> Libera is the new home for Nim-irc, these heathens are heathens
09:20:40PMunchWait..
09:20:45fn<hoijui> what happened to freenode? enemy takeover?
09:20:49PMunchWhen I type on Freenode it doesn't get relayed here
09:20:57PMunchAm I shadowbanned on Freenode?
09:21:05fn<Prestige> I didn't see you type on freenode
09:21:27FromDiscord<Elegantbeef> 1 too many liberachat messages
09:21:27fn<hoijui> mmm... strange. I see you here
09:21:42FromDiscord<Rika> have you forgotten that they wiped the db
09:21:48FromDiscord<Rika> so you have to reregister, i believe
09:21:53fn<hoijui> aha
09:21:55fn<Prestige> correct
09:22:13fn<hoijui> sliped my mind for a moment
09:22:24PMunchThis is what it looks like to me: https://uploads.peterme.net/shadowbanned.png
09:22:37PMunchWait what?
09:22:46PMunchThey deleted all Freenode users?
09:22:57FromDiscord<Elegantbeef> Yep
09:23:01FromDiscord<Elegantbeef> Hence the sudden move to libera
09:23:10FromDiscord<Elegantbeef> Users + servers iirc
09:23:53fn<hoijui> why do you see PMunch as an IRC user instead of as a "remote" one?
09:23:55fn<hoijui> on IRC
09:23:58PMunchI thought the whole point was to get access to all the users..
09:24:06fn<hoijui> and.. you DO see me there
09:24:06FromDiscord<zetashift> In reply to @PMunch "This is what it": very nice colorscheme tho
09:24:08PMunchBecause I om on IRC
09:24:09PMunch:P
09:24:23PMunchOh well, I have to run
09:24:35FromDiscord<Elegantbeef> And i have to sleep
09:24:39fn<hoijui> I am on IRC too, and PMunch to me is not on IRC
09:24:44PMunch@zetashift, it's based on the same colourtheme that's used for the Nim website code snippets
09:24:44FromDiscord<zetashift> good run and good night!
09:25:01*PMunch quit (Quit: leaving)
09:25:05FromDiscord<zetashift> Dracula?
09:25:25FromDiscord<zetashift> it doesn't resemble it at first glance
09:26:13fn<Prestige> Oh PMunch can you link me that repo
09:26:20FromDiscord<dom96> honestly, you should all move to Libera
09:26:24fn<Prestige> I didn't see your message till the screenshot
09:26:24FromDiscord<dom96> no reason not to
09:26:59FromDiscord<Elegantbeef> You're not my real mom dom, you cannot tell me how to live
09:27:35fn<Prestige> dom96 or everyone come back to freenode, or we could start our own irc network :P
09:27:44FromDiscord<Rika> dommom
09:27:44fn<Prestige> or we could all move to matrix, or...
09:27:54FromDiscord<dom96> bruh, you're not even on IRC
09:27:58FromDiscord<Rika> domomdom
09:28:27FromDiscord<dom96> Yep, I'm the dominant mom of this channel
09:28:45FromDiscord<dom96> only my britishness cannot help but want to write _mum_
09:29:36FromDiscord<dom96> happy friday btw πŸ™‚
09:30:00FromDiscord<tomck> Is there any reason why the options `some` function doesn't take a `sink T` parameter? it seems to want to copy `T` all the time, & it magically works if I change `T` to `sink T`
09:45:47FromDiscord<dom96> @Araq Any ideas about above?
09:53:22FromDiscord<gerwy> i will probably be making some small app to display and play around with Cellular Automatas in nim↡How should i name it?
09:57:21FromDiscord<gerwy> nimca?
09:57:25FromDiscord<dom96> nooo
09:57:32FromDiscord<dom96> it should have no nim in the name
09:57:37FromDiscord<dom96> too many projects with a nim prefix
09:58:06FromDiscord<dom96> First name that comes to mind: AutomataOverlord
09:58:42fn<hoijui> Elegantbeef, regarding your maverick bot ...
09:58:57fn<hoijui> I just saw, that you do . basically what I woudl want, I think
09:59:08fn<hoijui> you have a dir with commands
09:59:21fn<hoijui> and you import all of them with a macro
09:59:22FromDiscord<zetashift> Tomatas!
09:59:41FromDiscord<gerwy> In reply to @dom96 "it should have no": why, you don't like when things are associated with nim? I think its pretty cool and cute that so many projects have this
09:59:48FromDiscord<Rika> its dull
09:59:49fn<hoijui> I then run an other macro to register them to my... commands registry
10:00:05FromDiscord<Rika> nim-xxx nimxxx xxxnim xnimx gets old really quickly
10:00:19FromDiscord<dom96> I don't like having dozens of projects that begin with nim and then my `cd nim` tab complete failing heh
10:00:28FromDiscord<Rika> they can always just see the language its written in in the languages bar thing of github
10:00:32fn<hoijui> you seem not to have to do that... why not? how do the commands become effective/usable?
10:01:04FromDiscord<gerwy> well for your context i think it will be just to play around with ↡Game of Life↡Ants and Rule X↡and maybe, just maybee i will add option to make your own CA with custom rules and states
10:01:29FromDiscord<gerwy> In reply to @dom96 "I don't like having": but you don't download all projects made in nim right? right?
10:01:55FromDiscord<dom96> I download enough that it annoys me that too many begin with `nim` lol
10:02:01FromDiscord<gerwy> In reply to @zetashift "Tomatas!": thats nice, but i think it has too much to do with tomato and people could get confused haha
10:02:15FromDiscord<tomck> I have lots of `nim-xxx` clones too, it's annoying, suffix with nim instead
10:02:20FromDiscord<gerwy> ah i understand, well i can always change its name i guess
10:03:30fn<hoijui> ahh.. I think you create a table with commands somewhere, right, Elegantbeef
10:03:45FromDiscord<Rika> In reply to @tomck "I have lots of": i'm not for suffixes either
10:04:14FromDiscord<Rika> just dont put it, it's going to be obvious its a nim project because the language is listed as well on github anyway
10:04:32FromDiscord<Rika> even worse if you put it on the nimble package name
10:04:51FromDiscord<gerwy> lol i could call it Edumata
10:04:54FromDiscord<gerwy> or just mata
10:04:57FromDiscord<gerwy> ta
10:05:15FromDiscord<Rika> eh
10:05:29FromDiscord<gerwy> mata seems fine
10:05:32FromDiscord<tomck> dunno about you but i often remake projects in different languages when they're non-trivial, so i play about with it in common lisp (and name it XXX-cl) then move to some other lang (and name it XXX-nim)
10:05:54FromDiscord<gerwy> CA-nim
10:05:57FromDiscord<gerwy> na
10:06:00FromDiscord<gerwy> (edit) "na" => "nah"
10:06:22FromDiscord<gerwy> it sounds like some american anti-terrorist forces
10:06:43FromDiscord<tomck> If i want to edit nim's stdlib for a project, but I don't want to change the compiler, what're my options
10:06:56FromDiscord<tomck> ideally i'd rather not fork the compiler & have to build a fresh one just to build my project
10:07:12FromDiscord<Araq> @tomck we haven't updated the stdlib with `sink` annotations all that much yet.
10:07:24FromDiscord<Araq> we had sink parameter inference instead but it's flawed
10:07:33FromDiscord<Araq> and so mostly disabled
10:07:49FromDiscord<tomck> @Araq Ah ok yeah i figured, can i just add it then (?) unsure what the process for getting this merged would be, it's a semi-blocker on my current project
10:07:57FromDiscord<gerwy> also i want this project to be a little more maintainable so i would like to use nimble and all↡↡is there any nice nimble tutorial?
10:08:01FromDiscord<Araq> PRs are accepted
10:08:11FromDiscord<Rika> In reply to @tomck "If i want to": copy the files into another folder and use it like a normal module?
10:08:38FromDiscord<tomck> yeah but then if i import `options`, that'll just import the stdlib (right?)
10:08:49FromDiscord<Rika> uh, no i mean
10:09:00FromDiscord<Rika> stdlib as a module, not as a collection of modules
10:09:06FromDiscord<Rika> so you do import std2/options
10:09:28FromDiscord<Rika> (and you can force it with import pkg/options anyway but thatll clobber with other peoples packages called options)
10:09:34FromDiscord<zetashift> https://github.com/disruptek/disruptek/blob/master/style.md#packaging reminds me of this
10:09:35FromDiscord<zetashift> `Don't use .nim or nim- or nim in your package name; we all know it's nim, that's why we're here -- use keywords if you want to influence search results.`
10:09:36FromDiscord<planetis> none i guess, try it and make a PR, also use .nodestroy↡(@tomck)
10:09:36FromDiscord<mantielero (mantielero)> > So it is either UB or `const_cast`↡Finally it worked. Thanks.
10:09:39FromDiscord<tomck> yeah but then if i interface with other libs that use the normal stdlib options i'm fucked because i'll have to convert between std2 and std
10:09:57FromDiscord<Rika> theres no way around that
10:10:12FromDiscord<tomck> planetis: what does nodestroy do? i struggled to understand from the docs
10:10:26FromDiscord<tomck> @Rika what i really want is to just swap out the stdlib on the compiler, is there a flag for that
10:10:33FromDiscord<Rika> if you want to change a single proc just make a "procname2" and use that
10:10:39FromDiscord<Rika> uh
10:10:42FromDiscord<Rika> not that i know of?
10:10:51FromDiscord<Rika> maybe check the nimc docs
10:11:00FromDiscord<Rika> https://nim-lang.org/docs/nimc.html
10:11:11FromDiscord<tomck> there's a flag to change the 'system library path', `--lib`, not sure what that means
10:11:18FromDiscord<tomck> oh i could settle for a `some2` for now
10:11:25FromDiscord<Rika> sounds like thats what you want?
10:11:31FromDiscord<planetis> its forces the compiler not to write destructor calls
10:11:47FromDiscord<tomck> problem is all the fields of `Option` are private, is there any way to bypass that?
10:12:02FromDiscord<tomck> planetis: i don't think that's what i want, i just want to force a move
10:12:08FromDiscord<Rika> you can
10:12:22FromDiscord<planetis> only in its scope
10:12:27FromDiscord<Rika> copy option type, name it idk option2, cast, then do whatever, then cast back
10:12:35FromDiscord<zetashift> well it's just a guideline not a rule, I think that naming scheme works too if you're a polyglot↡(@tomck)
10:12:35FromDiscord<Rika> ofc hacky
10:12:39FromDiscord<Rika> has cast, so dangerous
10:13:14FromDiscord<tomck> planetis: oh cool, does a `nodestroy` var use `copy=` still? because i'm deleting that, that's the issue. Maybe `shallowCopy` works (??)
10:13:38FromDiscord<tomck> lmao ok i'll have a think about the whole cast thing
10:14:09FromDiscord<Rika> In reply to @tomck "dunno about you but": personally as im a massive weeb i name my projects over names of the (semi-)fictional girls i like so i have plenty of name options
10:14:19FromDiscord<dom96> just clone the compiler and fix it, if you're using Nim seriously you should have a devel check out anyway
10:14:41FromDiscord<tomck> yeah i just don't want to have to use devel for this project for the next N months
10:14:56FromDiscord<dom96> In reply to @Araq "we had sink parameter": will it get fixed or are we just destined to have sink annotations everywhere?
10:16:05FromDiscord<tomck> honestly i like sink annotations, sink inference feels a bit hands off to me↡If there was a way to bypass module name scopes, it'd be easy enough to have per-project reimplementations of functions that're missing `sink` in the stdlib
10:18:05FromDiscord<dom96> sink annotations are coming too close to Rust's lifetime annotations to me
10:18:34FromDiscord<dom96> but I suppose it is still just an optimisation rather than a strict requirement
10:19:29FromDiscord<tomck> ehh i dunno, nim does it the other way - assume everything is a borrow, annotate a move, & then just silently copy if something goes wrong
10:19:45*Torro joined #nim
10:19:55FromDiscord<tomck> it's still pretty frictionless, we're not quite at `Foo<'a, Bar<'a>>` just yet lol
10:22:18FromDiscord<tomck> hmmm so I've copied the stdlib into my project, and i'm pointing to itt with `--lib:custom-stdlib/`, but it's still finding `options` in the original place
10:22:26FromDiscord<tomck> does anyone know what the `--lib` flag on the compiler does?
10:23:08FromDiscord<haxscramper> `--lib:PATH set the system library path`
10:23:13FromDiscord<haxscramper> `nim --fullhelp`
10:23:39FromDiscord<haxscramper> For nim modules use `--path`, this is for dynamic libraries I think
10:23:55arkanoidI'm headed to learning how to acquire some of the benefits of functional programming into nim. I'm talking about side-effects-free core logic while pushing stateful stuff on the edge. I'm currently forcing myself using "let" and "func" instead of "var" and "proc" in core logic. What else can I ask nim to do for me? Any idea?
10:24:38FromDiscord<Rika> experimental strict funcs?
10:24:42FromDiscord<planetis> why would you delete copy, then enable it explicitly?, can you .error sink instead?
10:24:43FromDiscord<planetis> ok youre copying rusts design
10:24:43FromDiscord<planetis> why would you delete copy, then enable it explicitly?
10:24:44FromDiscord<planetis> do --expandarc\:some and find out↡(@tomck)
10:24:51FromDiscord<haxscramper> In reply to @arkanoid "I'm headed to learning": https://github.com/arnetheduck/nim-result https://github.com/zero-functional/zero-functional
10:24:52fn<R2D2> itHub: 7"Friendly, exception-free value-or-error returns, similar to Option[T]"
10:25:56FromDiscord<tomck> planetis: because disabling copy for certain things is very useful, you see it in c++ all the time
10:26:10FromDiscord<haxscramper> `.raises[].` annotations can be used to avoid exceptions as well
10:27:09FromDiscord<planetis> ok i get it↡(@tomck)
10:27:12FromDiscord<tomck> Oh ok i figured it out, `--lib` works to set the stdlib path, but you need to pass the flag earlier (??), i think it was getting consumed by my application rather than the compiler↡↡So `nim c --lib:/foo -r src/code.nim` will point the stdlib to `/foo`, so that's all fixed
10:28:58*saem[m] quit (Quit: Bridge terminating on SIGTERM)
10:29:20FromDiscord<tomck> haxscramper: what does .raises[]. do?
10:29:58FromDiscord<Rika> ensures no exceptions are raised
10:30:04*max22- joined #nim
10:30:58*Clonkk[m] joined #nim
10:31:24FromDiscord<Rika> and are unhandled
10:31:36*Zoom[m] joined #nim
10:31:36*saem[m] joined #nim
10:31:36*nixfreak_nim[m] joined #nim
10:31:36*Helios joined #nim
10:32:29FromDiscord<tomck> oh i see, cool
10:32:43FromDiscord<tomck> whilst I'm here, is there any way to get Table to return an Option or equivalent?
10:33:05FromDiscord<tomck> i see it has `getOrDefault`, but the type I have in `Table` has no proper 'default' value
10:33:26FromDiscord<tomck> I don't really want to catch an exception because it's in a pretty tight loop, unless nim does weird optimisations with exceptions i'm unaware of
10:33:30FromDiscord<Rika> not that i know of currently
10:33:42FromDiscord<tomck> rip↡guess i have a custom stdlib now though lol
10:33:43FromDiscord<Rika> nim exceptions are relatively fast i think?
10:34:32FromDiscord<tomck> i'm sure they are, i just don't know how it'd mess with stuff in a tight loop
10:34:55FromDiscord<tomck> would a PR be accepted to add an Option alternative, or do we want to keep the modules as separate as possible
10:36:41FromDiscord<Rika> idk search it first then try it
10:37:45FromDiscord<planetis> they are goto based
10:38:18*Epsilon quit (Remote host closed the connection)
10:38:33*Epsilon joined #nim
10:44:58FromDiscord<planetis> also can you please make a benchmark with your alternative too? In my experience returning an option would be slower, but not sure vs exceptions
10:46:32FromDiscord<Araq> I recently benchmarked exceptions vs Option[T] and exceptions (via --exceptions:goto) where faster
10:46:49FromDiscord<Araq> for my benchmark anyway, of course.
10:46:58FromDiscord<planetis> also why make a fork of stdlib while a adding sink pr are merged on the same day?
10:48:45FromDiscord<tomck> interesting, i'll make a benchmark for it then, i have no idea how goto exceptions work
10:48:58FromDiscord<tomck> b/c i don't want to have to get a devel build of the compiler just to compile my project
10:50:17FromDiscord<planetis> it doesnt suprise me, so not going to question it
10:52:01FromDiscord<planetis> options just add even more states to my code for no benefit so tend to not use them
10:53:11arkanoidRika, thanks. Didn't know about experimental strict funcs
10:53:23FromDiscord<Rika> yeah its relatively new
11:00:01*Torro quit (Quit: leaving)
11:27:19FromDiscord<planetis> In old nim you had to use "if hasKey\:" before "table[key]" (and afaik was the reason for the withValue template), now you can just use "try\: except ValueEror\:", thats actually a big improvement. Congratulations Araq!
11:41:23FromDiscord<mantielero (mantielero)> I am playing for the first time with `nimline`. How would you do this?
11:41:30FromDiscord<mantielero (mantielero)> sent a long message, see http://ix.io/3r4U
11:41:49FromDiscord<mantielero (mantielero)> \`\`\`c++
11:42:32FromDiscord<mantielero (mantielero)> sent a code paste, see https://play.nim-lang.org/#ix=3r4V
11:42:34FromDiscord<mantielero (mantielero)> (better now)
11:43:26FromDiscord<vindaar> I'm gonna stick to `hasKey` and manually adding (or `hasKeyOrPut` directly) over try / except πŸ˜…
11:45:23*fn quit (Remote host closed the connection)
11:45:28FromDiscord<haxscramper> https://github.com/sinkingsugar/nimline/blob/703d6aec1f466a3ccbc757243185ea7349f7345c/README.md#constructors-and-destructors I think you can use `cppnewref`
11:45:32FromDiscord<haxscramper> In this case at least
11:45:40*fn joined #nim
11:47:15FromDiscord<haxscramper> Although I suspect it is broken for namespaced classes
11:49:47FromDiscord<mantielero (mantielero)> sent a code paste, see https://play.nim-lang.org/#ix=3r50
11:51:07FromDiscord<haxscramper> Failed how? And if `sym` is a static method you don't need to call on the instance
11:51:36FromDiscord<haxscramper> I provided an example of how to interface with static methods
11:53:37*max22- quit (Ping timeout: 246 seconds)
11:54:08FromDiscord<planetis> I dunno, I was short of asking \:P
11:56:50FromDiscord<mantielero (mantielero)> Sorry I don't get it (I am not a pro-developer)
11:59:26FromDiscord<haxscramper> First - you said it failed. How exactly? Compilation error, runtime error, unexpected output?
12:00:40FromDiscord<mantielero (mantielero)> sent a code paste, see https://play.nim-lang.org/#ix=3r57
12:00:49FromDiscord<mantielero (mantielero)> Gotta have lunch now (I'll com back later)
12:00:53FromDiscord<haxscramper> Second - C++ has notion of static methods that don't require object instance when called, so if `Mx::sym` is a static method (which I assume it is, at least judging from the C++ code you showed earlier) you need to wrap it as `importcpp: "MX::sym"` for a procedure without additional `MX` parameter
12:05:13FromDiscord<haxscramper> Third - I've looked at the nimline's implementation and I would say that it might be better to wrap some things manually, unless you need to wrap the whole `MX` class (and even in this case I'm not sure if nimline is a good starting point. Seems like it does not provide any means to automatically mass-wrap methods)
12:05:14FromDiscord<haxscramper> I linked it mostly because it implements `StdString` wrapper that you needed https://github.com/sinkingsugar/nimline/tree/703d6aec1f466a3ccbc757243185ea7349f7345c#standard-library-helpers
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:43*supakeen joined #nim
12:12:32FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3r5b
12:28:43*arkurious joined #nim
12:31:14FromDiscord<mantielero (mantielero)> Thanks a lot for your clarifications
12:34:40*fn-test joined #nim
12:38:43fn<restige99> Is the color of my nick messed up over on libera?
12:40:11fn<restige99> Was testing using their webchat and it looked off, but it's fine in my irc client
12:42:20FromDiscord<tomck> sent a long message, see http://ix.io/3r5h
12:42:42FromDiscord<tomck> Unsure if i'm turning on 'goto exceptions' properly, that's the flag i saw in the article on nim-lang.org
12:43:16*fn-test quit (Remote host closed the connection)
12:43:22FromDiscord<tomck> (edit) "http://ix.io/3r5h" => "http://ix.io/3r5i"
12:43:31FromDiscord<dom96> huh, that's very surprising
12:44:39FromDiscord<tomck> note it's more like 10x slower than default values, it's only 4x slower when the table has 1mil items, so you get more noise from cache misses b/c it doesn't fit in memory
12:46:01FromDiscord<tomck> I think i'm not turning on the special exceptions properly, because i'm getting the same performance with/without the `--exceptions:goto` flag
12:47:32FromDiscord<Araq> you need the -d:release (or -d:danger) switch
12:47:41FromDiscord<Araq> (edit) "you ... need" added "also"
12:48:01FromDiscord<Araq> --opt:speed is not gonna cut it, the stack tracing skews all results otherwise
12:48:08FromDiscord<planetis> @tomck nice
12:48:51FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=3r5j
12:49:33FromDiscord<Araq> dunno, benchmarking is hard, also try `--gc:orc` (which implies the goto exceptions)
12:50:46FromDiscord<tomck> weird, gc:orc and gc:arc are MUCH slower, probably because they inc/dec references
12:51:35FromDiscord<tomck> what about a proc that returned a pointer to the table value, that way if you care about perf you can do what you want with it & deal with iterator invalidation, but if you don't you just don't touch it
12:53:14*fn quit (Remote host closed the connection)
12:53:30*fn joined #nim
12:59:27*hoijui joined #nim
13:01:42FromDiscord<planetis> https://play.nim-lang.org/#ix=3r5m wit options
13:04:05FromDiscord<planetis> so you are benchmarking the extreme senario when is empty
13:04:26FromDiscord<planetis> ok i had more normal usage in mind
13:04:36FromDiscord<tomck> the 'extreme' scenario?
13:04:42FromDiscord<planetis> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/857969394746261564): so you are benchmarking the extreme scenario when is empty
13:04:42FromDiscord<tomck> it's 50% hits, or should be
13:05:02FromDiscord<tomck> not all misses - & i don't think all misses is even that extreme
13:05:23FromDiscord<planetis> oh ok
13:05:37FromDiscord<planetis> my bad i see setupTestTable now
13:05:42FromDiscord<planetis> missed it
13:05:54FromDiscord<tomck> np
13:06:20FromDiscord<tomck> right i've added an option return to my stdlib copy, i'll setup a PR for that tonight & we shall see, gtg now
13:07:20FromDiscord<planetis> bye
13:10:27FromDiscord<planetis> its a bit faster if you remove KeyError
13:20:40*max22- joined #nim
13:22:48FromDiscord<planetis> we are basically seeing allocating and deallocating KeyError
13:35:48FromDiscord<planetis> this is weird right?
13:35:49FromDiscord<planetis> Screenshot\_20210625\_162942.png https://media.discordapp.net/attachments/371759389889003532/857977382496895006/Screenshot_20210625_162942.png
13:35:57FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3r5A
13:36:47FromDiscord<haxscramper> Would it make sense to spend time on placing cursor annotations everywhere or otherwise this might be caused by unnecessary copying that I should try to find?
13:40:02FromDiscord<offbeat-stuff (offbeat-stuff)> Hi, is there a pragma like {.define(ssl).} that i can use
13:40:58FromDiscord<haxscramper> no, you need to pass `-d:ssl` from the command line/config file
13:48:04*hoijui quit (Ping timeout: 244 seconds)
13:52:11FromDiscord<offbeat-stuff (offbeat-stuff)> actually it is exactly {.define(ssl).}
13:52:24FromDiscord<offbeat-stuff (offbeat-stuff)> just have to use it just before importing the module
13:58:32FromDiscord<haxscramper> Ah, it seems I confused recommendation not to do this vs "it does not work"
13:59:04*hoijui joined #nim
14:03:17FromDiscord<planetis> anyone knows why sumWithHasKey seems to be twice slower than raising, in that benchmark? only with perf
14:09:36FromDiscord<planetis> that benchmark is super weird, I changed setupTestTable to be always filled, removed the try block and getting same results
14:10:06FromDiscord<planetis> https://play.nim-lang.org/#ix=3r5N
14:11:19FromDiscord<Araq> still a good point, we need to remove these allocations πŸ™‚
14:11:58FromDiscord<Araq> I wonder why it didn't show up in my benchmark, probably because I test exception propagation, not exception allocation
14:14:08*SebastianM joined #nim
14:16:29FromDiscord<planetis> ...and also strstr\_sse was poping up with except KeyError but until i unconfuse myself I don't know how but was that
14:21:02FromDiscord<leorize> because of how RTTI in arc/orc work
14:21:22FromDiscord<planetis> my guess is sumWithDefault and sumWithOpt are optimized away so @tomck you weren't benchmarking anything useful
14:21:30FromDiscord<leorize> `of` is done via a string in the object with every parent in it
14:21:52FromDiscord<leorize> then Nim uses strstr to scan for the parent
14:22:18FromDiscord<leorize> it's pretty inefficient tbh
14:24:21*rockcavera joined #nim
14:24:21*rockcavera quit (Changing host)
14:24:21*rockcavera joined #nim
14:27:00fn<ForumUpdaterBot99> New thread by Tsojtsoj: Is there a built in way to get how high total CPU usage is?, see https://forum.nim-lang.org/t/8155
14:30:10*SebastianM quit (Quit: Bye)
14:33:27*rockcavera quit (Read error: Connection reset by peer)
14:33:50*rockcavera joined #nim
14:33:50*rockcavera quit (Changing host)
14:33:50*rockcavera joined #nim
14:36:13*Derbycat joined #nim
14:50:22*notchris_ is now known as notchris
15:07:38*supakeen quit (Remote host closed the connection)
15:08:02*supakeen joined #nim
15:08:54FromDiscord<planetis> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/857988846141833283): my guess is sumWithDefault and sumWithOpt are optimized away so tomck#5836 you weren't benchmarking anything useful (confirmed)
15:11:38FromDiscord<tomck> planetis: Hmmm how so? it's not like they take 0 time, they take time proportional to how big the table is
15:12:08FromDiscord<planetis> i confirmed it
15:12:17FromDiscord<tomck> so what's it spending time doing when it takes 3ms
15:12:23FromDiscord<planetis> look at the assembly really quick
15:13:43FromDiscord<tomck> doesn't look optimised away, is there an earlyr eturn or something i'm not spotting? might be optimised away on your compiler, i'm on 1.5.1
15:14:22FromDiscord<tomck> oh no, looks like i'm on nightly? i'm on the 1.5.1 tag on gitnim, idk what that means
15:14:58FromDiscord<planetis> better question is what's your c compiler, mine is clang
15:15:32FromDiscord<tomck> err i have a bunch, how does nim choose
15:15:50FromDiscord<tomck> it's either gcc7.5 or clang 9
15:16:13FromDiscord<tomck> regardless, it's not optimised away on mine, & i'm seeing 8x slowdown
15:16:24FromDiscord<tomck> if it was optimised away i'd be seeing like 100000x slowdown
15:16:55FromDiscord<planetis> --cc\:clang/gcc/..
15:16:55FromDiscord<planetis> make it first argument (after nim c )
15:16:55FromDiscord<planetis> make it first argument
15:18:04FromDiscord<planetis> then your are not compiling with -d\:danger
15:18:08FromDiscord<tomck> yeah it's not optimising it away with clang
15:18:26FromDiscord<tomck> i tried both danger & release, although i'm not sure i waant to compile with a flag called 'danger' lol
15:18:51FromDiscord<tomck> yeah under danger on clang it's optimising the default one away
15:19:31FromDiscord<tomck> not optimising the hasKey check though, i'm still getting 8x slower than haskey, so it's obviously still an issue
15:19:38FromDiscord<planetis> ok gcc
15:20:02FromDiscord<tomck> what?
15:20:44FromDiscord<planetis> im not getting useful numbers
15:21:21FromDiscord<planetis> either way you need to make sure stuff doesn't get optimized away
15:26:21FromDiscord<gerwy> how to setup nimble?
15:27:33FromDiscord<kaushalmodi> In reply to @Life Sucks "how to setup nimble?": It gets installed as part of nim installations.↡↡What does a setup mean?
15:28:01FromDiscord<gerwy> or maybe other way↡what advantages i get when creating nimble project? Does i really need it?
15:29:34FromDiscord<kaushalmodi> sent a long message, see http://ix.io/3r6h
15:30:31FromDiscord<kaushalmodi> See https://github.com/nim-lang/nimble#creating-packages for more info.
15:30:33fn<R2D299> itHub: 7"Package manager for the Nim programming language."
15:30:47FromDiscord<gerwy> oh right, i thought its easy only if it will be used as module, not if i was making an app
15:31:06FromDiscord<gerwy> also i already have git repo in that folder :<<
15:31:11FromDiscord<kaushalmodi> In reply to @Life Sucks "oh right, i": Nimble is useful for lib/app/hybrid packages -- all
15:31:55FromDiscord<gerwy> ooh i see there are other types of nimble projects
15:31:57FromDiscord<kaushalmodi> In reply to @Life Sucks "also i already have": That's OK. `nimble init` does the right thing whether you already have a project folder created or not. If you already have a git repo dir, cd to that dir and then do `nimble init`.
15:31:59FromDiscord<gerwy> thats so coool
15:33:29FromDiscord<gerwy> so if its an app, i do `binary`?
15:34:12FromDiscord<kaushalmodi> In reply to @Life Sucks "so if its an": Yes
15:34:25FromDiscord<gerwy> yaaay okay thank you<3
15:36:46FromDiscord<gerwy> oh god i need to choose license too and i have no idea which is the best like always
15:39:26FromDiscord<kaushalmodi> In reply to @Life Sucks "oh god i need": You might get multiple answers here. I use MIT.
15:40:20FromDiscord<kaushalmodi> In reply to @Life Sucks "oh god i need": https://choosealicense.com/licenses/
15:41:19FromDiscord<gerwy> yeah its probably the best for me, im not good at choosing which is better because i don't see so much difference
15:42:13FromDiscord<gerwy> but MIT seems right
16:05:40*Epsilon quit (Remote host closed the connection)
16:05:58*Epsilon joined #nim
16:08:16FromDiscord<planetis> @tomck I can confirm your numbers\: https://play.nim-lang.org/#ix=3r6v
16:32:06FromDiscord<planetis> https://play.nim-lang.org/#ix=3r6C
16:34:27*beshr quit (Read error: Connection reset by peer)
16:47:04FromDiscord<emef> are there any automatic source formatters for nim like go fmt or scalafmt?
16:47:18FromDiscord<emef> there is a nimfmt package on github that is abandoned and doesn't compile
16:47:27FromDiscord<leorize> nimpretty but it's not opinionated
16:48:40FromDiscord<emef> thanks will look into that
16:48:48*vicfred joined #nim
16:49:21FromDiscord<treeform> I also made `morepretty` that uses nimpretty but goes beyond and is even more opinionated.
16:50:06*deshordash joined #nim
16:50:36FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3r6I
16:50:49FromDiscord<Canelhas> In reply to @treeform "I also made `morepretty`": this one, i assume?↡https://github.com/treeform/morepretty
16:50:51fn<R2D299> itHub: 7"Morepretty - like nimpretty but with more stuff."
16:51:02FromDiscord<leorize> iterable is a typeclass now
16:52:14*deshordash quit (Remote host closed the connection)
16:53:24*PersonMcGuy joined #nim
16:59:09PersonMcGuyHello, sorry if this a stupid question, but is it possible to have multiple types for the value in a table? i.e. Table[string, int | float] ?
16:59:30FromDiscord<treeform> It looks like this is the a function I want to work, but it just does not work for walk dir: https://github.com/def-/nim-iterutils/blob/master/src/iterutils.nim#L90
17:00:20FromDiscord<treeform> I don't understand what this error is telling me: `Error: attempting to call routine: 'walkDir'↡ found 'os.walkDir(dir: string, relative: bool, checkDir: bool) [declared in ....' of kind 'iterator'`
17:05:59FromDiscord<planetis> so this line\: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/tables.nim#L238-L241 makes `[]` 1-1.7x slower than getOrDefault even when not raising
17:10:43FromDiscord<zetashift> In reply to @PersonMcGuy "Hello, sorry if this": You could use a Variant for that
17:15:18PersonMcGuy@zetashift Thank you, looking into it now
17:19:32FromDiscord<hamidb80> i don't get it
17:19:50FromDiscord<hamidb80> https://media.discordapp.net/attachments/371759389889003532/858033756073754674/unknown.png
17:20:15FromDiscord<hamidb80> i ran compile `utils.nim` directly without any error
17:20:36FromDiscord<hamidb80> but importing it in another module gives me this
17:20:51FromDiscord<hamidb80> In reply to @hamidb80 "i ran compile `utils.nim`": i can
17:21:14FromDiscord<tomck> @hamidb80 that's because it's a template
17:21:28FromDiscord<tomck> so when you call the template, it generated the code that calls mapIt in the module you call the template from
17:21:37FromDiscord<tomck> so the module you call the template from also needs to import mapIt, i believe (?)
17:22:00FromDiscord<hamidb80> hmm
17:22:57FromDiscord<hamidb80> template hygiene ..
17:24:45FromDiscord<tomck> i don't know if that's 'unhygeinic'
17:25:41FromDiscord<leorize> add `bind mapIt` to your template
17:25:59FromDiscord<leorize> then the mapIt symbol will be resolved to the one available at your implementation scope
17:34:59*vsantana joined #nim
17:48:32*vsantana1 joined #nim
17:50:54*vsantana quit (Ping timeout: 244 seconds)
17:50:54*vsantana1 is now known as vsantana
17:53:37FromDiscord<kaushalmodi> In reply to @leorize "add `bind mapIt` to": TIL about `bind`: https://nim-lang.github.io/Nim/manual#generics-bind-statement
17:58:03*PersonMcGuy quit (Quit: https://mibbit.com Online IRC Client)
18:23:51*Gustavo6046 quit (Read error: Connection reset by peer)
18:36:36*rockcavera quit (Remote host closed the connection)
18:36:58*mst joined #nim
18:40:48*rockcavera joined #nim
18:40:49*rockcavera quit (Changing host)
18:40:49*rockcavera joined #nim
18:44:09*ozzz_ joined #nim
18:45:28*ozzz quit (Ping timeout: 265 seconds)
18:48:08FromDiscord<gerwy> In reply to @hamidb80 "": how did you got that crown in VS Code? It looks super cool
18:49:35*Gustavo6046 joined #nim
18:58:42*vsantana quit (Ping timeout: 258 seconds)
19:01:02FromDiscord<Elegantbeef> @gerwy\: https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme
19:08:04*hoijui quit (Quit: Leaving)
19:16:13FromDiscord<gerwy> Thank you :O
19:36:42*cyraxjoe quit (Ping timeout: 265 seconds)
19:37:07*cyraxjoe joined #nim
19:38:32*MightyJoe joined #nim
19:42:06*cyraxjoe quit (Ping timeout: 252 seconds)
19:45:12FromDiscord<checkersai> In reply to @checkersai "Just curious, is there": Found the answer to my question last night btw for anyone else that's curious: https://nim-lang.org/docs/system.html#compileOption%2Cstring
19:47:23FromDiscord<Traveler> Hello πŸ‘‹ , I am exploring nim a bit and I am wondering if anybody could help me pas std::string to nim. How does one achieve this?↡type↡ String {.importcpp: "std::string", header: "string".} = object This would give me the type, but do I also have to provide a proc for mapping nim strings to string and back?
19:57:49FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3r7K
19:58:39FromDiscord<haxscramper> In reply to @haxscramper "I linked it mostly": There are also couple of libraries that provide `std::string` wrappers
19:59:07FromDiscord<haxscramper> In reply to @Traveler "Hello πŸ‘‹ , I": You need to wrap corresponding methods, first example does that for `c_str()`
20:02:32FromDiscord<Kermithos> does nim has an inbuilt function to convert a bool to an int?
20:02:44FromDiscord<Kermithos> couldnt find any docs
20:02:58FromDiscord<@bracketmaster-5a708063d73408ce4> !eval true.int
20:03:00NimBotCompile failed: /usercode/in.nim(1, 5) Error: expression 'int(true)' is of type 'int' and has to be used (or discarded)
20:03:21FromDiscord<@bracketmaster-5a708063d73408ce4> !eval echo true.int
20:03:23NimBot1
20:03:28FromDiscord<Kermithos> ah nice
20:03:33FromDiscord<Kermithos> I only checked toInt()
20:03:34FromDiscord<Kermithos> thanks
20:03:53FromDiscord<@bracketmaster-5a708063d73408ce4> yes - in this case, `int()` is an initializer
20:09:00FromDiscord<Avahe> Where are people relaying from that are "bots" in discord that isn't irc?
20:09:23FromDiscord<Traveler> @haxscramper thanks! What libraries do this by default?
20:09:28FromDiscord<leorize> matrix↡(@Avahe)
20:09:47FromDiscord<Avahe> Oh are there two matrix channels now?
20:10:04FromDiscord<leorize> there's only one matrix channel that's active
20:12:43FromDiscord<Traveler> @haxscramper i see in the chat from the first link indeed a similar issue I have that if I bind a class to nim and init it with a cstr the field of that class is empty; I can set it manually, but cannot construct it the way nim types are initialized
20:14:57FromDiscord<haxscramper> You mean what libraries wrap `std::string`? I think there are several in addtion to what I linker earlier↡(@Traveler)
20:15:08FromDiscord<haxscramper> But I don't use them, so I can't comment really
20:15:32FromDiscord<haxscramper> You have nim type with `std::string` field and want to construct it on the nim side?↡(@Traveler)
20:17:46FromDiscord<haxscramper> Or you have C++-class and your problem is that you can't construct it using `Object(field: <std::string-expression>)` for field init?
20:20:38FromDiscord<Avahe> Oh I think I'm in the right one now
20:25:45FromDiscord<Traveler> In reply to @haxscramper "Or you have C++-class": I have a cpp class that I want to use inside nim
20:26:52FromDiscord<Traveler> It is a super simple class that has a `std::string` as a property. From the docs c_strings are no problem (which I can confirm); but wrapping it is, however i don't want to "reinvent" the wheel if already people have done the heavy lifting πŸ˜‰
20:28:29FromDiscord<Traveler> sent a code paste, see https://play.nim-lang.org/#ix=3r7W
20:29:18FromDiscord<Traveler> changing the type from `string` to `cstring` in nim type (and cpp class) it works, but im stuborn and want my std::strings to work :P!
20:29:25FromDiscord<Traveler> also initializing it with cstring yields empty
20:29:57FromDiscord<Traveler> i.e. `var obj = SomeClass(name: "test"); echo obj.name` yields `''`
20:30:12FromDiscord<Traveler> but setting it after the fact works normally
20:31:13FromDiscord<kaushalmodi> In reply to @Traveler "It is a super": Are you looking for this? https://github.com/Clonkk/nim-cppstl/blob/master/cppstl/std_string.nim
20:31:42FromDiscord<kaushalmodi> See the example usages in https://github.com/Clonkk/nim-cppstl/blob/master/tests/tstring.nim
20:33:49FromDiscord<Traveler> epic
20:33:56FromDiscord<Traveler> that looks good thanks @kaushalmodi
21:06:09FromDiscord<xDd> yo guys are there some objective c tutorials/blog posts i wanna import few libs from objc to nim can someone point me there πŸ˜›
21:06:46FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma there is this showcase which should help, but no clue about tutorials
21:08:09FromDiscord<@bracketmaster-5a708063d73408ce4> I was able to do this sometime ago - how do I access the name of a variable in nim?
21:08:30FromDiscord<xDd> Thanks @ElegantBeef i see this before but its very basic stuff πŸ˜„
21:10:27FromDiscord<Elegantbeef> what do you mean access the name of a variable, dump the name into a string?
21:10:27FromDiscord<@bracketmaster-5a708063d73408ce4> yes
21:10:39FromDiscord<@bracketmaster-5a708063d73408ce4> essentially, I have a proc, and it needs to print the name of the variable passed it
21:10:45FromDiscord<Elegantbeef> `astToStr`
21:11:45FromDiscord<Elegantbeef> !eval var a = 100; echo astToStr(a)
21:11:45FromDiscord<Elegantbeef> Damn nimbot letting me down
21:11:47NimBota
21:11:55FromDiscord<Elegantbeef> Ah actually that doesnt work, that just converts the ident
21:12:55FromDiscord<Elegantbeef> Even if a wasnt in scope it'd output `a`
21:13:43FromDiscord<@bracketmaster-5a708063d73408ce4> I remember having to use repr
21:15:34FromDiscord<Elegantbeef> So you want invoke a proc, and for it to print out the variables names passed in?
21:15:36FromDiscord<@bracketmaster-5a708063d73408ce4> yeah
21:15:42FromDiscord<@bracketmaster-5a708063d73408ce4> although proc may not be the way to go
21:15:56FromDiscord<@bracketmaster-5a708063d73408ce4> I wonder if I'd have to more or less go with macro
21:19:42FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r87
21:19:42FromDiscord<Elegantbeef> That will only echo out parameters which were passed as variables, so a literal wouldnt be printed
21:19:42FromDiscord<@bracketmaster-5a708063d73408ce4> hm - that's a neat idea
21:22:41FromDiscord<Elegantbeef> That's why they keep me around, that and i dont break any rules πŸ˜›
21:22:42FromDiscord<Elegantbeef> mostly the latter
21:22:42FromDiscord<@bracketmaster-5a708063d73408ce4> how long have you been nimming?
21:29:49FromDiscord<Elegantbeef> A year or 2
21:29:50FromDiscord<Elegantbeef> I write more macros than probably good for my health
21:29:50FromDiscord<@bracketmaster-5a708063d73408ce4> you know what they say
21:29:55FromDiscord<@bracketmaster-5a708063d73408ce4> a macro a day keeps the doctor away
21:36:00FromDiscord<Elegantbeef> The issue is the doctor it keeps away is the brain doctor
21:38:06FromDiscord<deech> How do I use the `[: T]` syntax for things like `ref` and `ptr`, `[: ptr T]` doesn't seem to work.
21:39:09FromDiscord<Elegantbeef> You sure? https://play.nim-lang.org/#ix=3r8b
21:39:27FromDiscord<Elegantbeef> that `[: T]` is for the method call syntax not procedure definitions
21:41:03FromDiscord<deech> https://play.nim-lang.org/#ix=3r8c
21:42:09FromDiscord<Elegantbeef> What are you even trying to do convert it back to `ptr int`?
21:42:41FromDiscord<@bracketmaster-5a708063d73408ce4> @elegantbeef\:matrix.org \: how can I change your doSomething proc to have the following signature `proc doSomething(a: int, name="default") = echo name`, and then have echoParams call `doSomething(a, name=`str`)`?
21:43:37FromDiscord<Elegantbeef> this how can i sounds more like "how can you" πŸ˜›
21:43:54FromDiscord<@bracketmaster-5a708063d73408ce4> well...
21:44:21FromDiscord<deech> The equivalent of `MyInt(10).cint` but of the type of `MyInt` was `MyInt = distinct ref int`.
21:44:51FromDiscord<deech> Or `distinct ptr int`.
21:45:46FromDiscord<Elegantbeef> Just changing it to `varargs[untyped]` works for that
21:45:47FromDiscord<Elegantbeef> Nah that's not the equivlent
21:45:48FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r8f
21:45:57FromDiscord<Elegantbeef> The `[: T]` is specifically for method call syntax for passing generics which is why it doesnt work here, you arent passing generics you're attempting to convert
21:46:20FromDiscord<deech> Ah makes sense.
21:46:30FromDiscord<deech> Thought I'd try my luck
21:46:59FromDiscord<Elegantbeef> cause when you do `a.someProc[T]()` it's evaluated as \`\`[]`(someproc(a), T)` not `someProc[T](a)`
21:47:57FromDiscord<Elegantbeef> Well i fucked the formatting but either way, it's not a conversion method, it's a specifically for generic method calls
21:48:55FromDiscord<Elegantbeef> one of the most simple examples i can talk about is something like `10.newSeq[: float]()` cs `10.newSeq[float]`
21:50:12FromDiscord<Elegantbeef> The first one compiles properly, the second one fails due to it trying `[](newSeq(10), float)` instead of the proper `newSeq[float](10)`
21:50:44FromDiscord<Elegantbeef> Hopefully that's not overly redundant and actually explains what's going on
21:51:30FromDiscord<deech> Makes a ton of sense. Thanks1
21:51:37FromDiscord<deech> (edit) "Thanks1" => "Thanks!"
21:53:08FromDiscord<Elegantbeef> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: The untyped version working for you?
21:53:21FromDiscord<@bracketmaster-5a708063d73408ce4> the untyped version?
21:53:38FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3r8i
21:53:40FromDiscord<@bracketmaster-5a708063d73408ce4> I'm trying to do something like that
21:54:11FromDiscord<@bracketmaster-5a708063d73408ce4> oh - I didn't try that? is that what I need?
21:54:12FromDiscord<Elegantbeef> replacing `varargs[typed]` with `varargs[untyped]`
21:54:18FromDiscord<@bracketmaster-5a708063d73408ce4> typed/untyped doesn't seem to be my issue
21:54:44FromDiscord<Elegantbeef> Well `name` isnt a parameter so `name =` will fail
21:55:02FromDiscord<Elegantbeef> if it's untyped you'll be able to use named parameter calls with no issue
21:55:31FromDiscord<@bracketmaster-5a708063d73408ce4> I'm afraid I don't quite follow
21:56:00FromDiscord<Elegantbeef> when doing `echoParams(doSomething, a, name = "hmm")` name isnt a parameter of the macro so it'll fail
21:56:07FromDiscord<Elegantbeef> due to being a typed macro
21:56:24FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r8j but as soon as you make it untyped, you can use the same syntax you'd use in a procedure and it just works https://play.nim-lang.org/#ix=3r8j
21:56:27FromDiscord<Elegantbeef> Lol double paste
21:56:30FromDiscord<Elegantbeef> I'm good at life
21:56:34FromDiscord<@bracketmaster-5a708063d73408ce4> I don't want to pass name to the macro
21:56:41FromDiscord<@bracketmaster-5a708063d73408ce4> I want the macro to pass name to doSomething
21:56:42FromDiscord<@bracketmaster-5a708063d73408ce4> lol
21:56:48FromDiscord<Elegantbeef> That's my point
21:57:24FromDiscord<Elegantbeef> `name =` will not work due to the macro not having a parameter of name if the args are typed, but if it's untyped it's just grabbed as is and can be passed along
21:57:53FromDiscord<Elegantbeef> Just look at that new link and run it, it does what you want without any effort
21:58:33FromDiscord<@bracketmaster-5a708063d73408ce4> what I mean is that we should be calling `echoParams(doSomething, a)` not `echoParams(doSomething, a, name = "hmmmm")`
21:58:55FromDiscord<@bracketmaster-5a708063d73408ce4> echoParams then calls doSomething and overides the name default
21:59:15FromDiscord<Elegantbeef> I dont see what the issue is?
21:59:35FromDiscord<Elegantbeef> You want echo params to have a default name parameter?
22:00:28*max22- quit (Quit: Leaving)
22:00:41FromDiscord<@bracketmaster-5a708063d73408ce4> calling `echoParams(doSomething, a)` should call `doSomething(a, name="a")`
22:00:48FromDiscord<Elegantbeef> ok
22:00:48FromDiscord<@bracketmaster-5a708063d73408ce4> calling `echoParams(doSomething, b)` should call `doSomething(b, name="b")`
22:00:51FromDiscord<@bracketmaster-5a708063d73408ce4> so on and so forth
22:01:00FromDiscord<@bracketmaster-5a708063d73408ce4> sorry - I wasn't very clear
22:03:26FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r8m
22:04:27FromDiscord<Elegantbeef> I am wondering if there is even a point to this macro to allow any procedure since it seems like you're using `doSomething` only
22:04:45FromDiscord<@bracketmaster-5a708063d73408ce4> I'll send you a snippet of how I actually end up using it
22:04:47FromDiscord<@bracketmaster-5a708063d73408ce4> thanks
22:04:51FromDiscord<@bracketmaster-5a708063d73408ce4> it will make sense
22:05:02FromDiscord<Elegantbeef> I wouldnt be so sure of myself
22:06:51*rockcavera quit (Remote host closed the connection)
22:23:57*supakeen quit (Remote host closed the connection)
22:24:20*supakeen joined #nim
22:48:14FromDiscord<@bracketmaster-5a708063d73408ce4> @elegantbeef\:matrix.org \: https://play.nim-lang.org/#ix=3r8s
22:48:37FromDiscord<@bracketmaster-5a708063d73408ce4> I'm making a simulator for the POWERPC architecture\: https://github.com/BracketMaster/nimulatorPPC/tree/ad362bd0376a12ae829592ea5e6b8003f0cea214
22:48:49FromDiscord<@bracketmaster-5a708063d73408ce4> oops\: https://github.com/BracketMaster/nimulatorPPC
22:48:52fn<R2D299> itHub: 7"A POWER9 emulator written in nim."
22:49:12FromDiscord<@bracketmaster-5a708063d73408ce4> To help debug, I need to be able to see what registers have changed between instructions
22:49:19FromDiscord<@bracketmaster-5a708063d73408ce4> so that's why
22:49:22FromDiscord<@bracketmaster-5a708063d73408ce4> I hope it makes sense now
22:50:10FromDiscord<Elegantbeef> How large is the state?
22:50:35FromDiscord<@bracketmaster-5a708063d73408ce4> power has roughly 2000 general purpose registers
22:50:46FromDiscord<@bracketmaster-5a708063d73408ce4> but only up to 5 change every instruction
22:50:49FromDiscord<Elegantbeef> Ah you're holding state anyway
22:51:07FromDiscord<Elegantbeef> i can show you what i'd do
22:51:13FromDiscord<@bracketmaster-5a708063d73408ce4> sure
22:56:07FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r8t this might be better
22:57:23FromDiscord<Elegantbeef> Well obviously changing it so it prints the index πŸ˜€
22:58:13FromDiscord<Elegantbeef> And you can always define a debug switch
22:59:00FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3r8u as such here
22:59:09FromDiscord<Elegantbeef> without `-d:debugRegs` it does nothing, but with it will print out reg changes
23:00:01FromDiscord<Elegantbeef> and of course i made a typo, should be `defined`
23:00:02FromDiscord<@bracketmaster-5a708063d73408ce4> this is actually very elegant
23:00:18FromDiscord<@bracketmaster-5a708063d73408ce4> you should change your name to elegantNim
23:00:30FromDiscord<Elegantbeef> Lol
23:01:00FromDiscord<Elegantbeef> I mean it's about doing the most with the least, the simplest solution is often the most elegant
23:01:19FromDiscord<@bracketmaster-5a708063d73408ce4> one slight problem
23:01:20FromDiscord<@bracketmaster-5a708063d73408ce4> https://github.com/BracketMaster/nimulatorPPC/blob/main/src/cpu/regfiles.nim#L6
23:01:25FromDiscord<@bracketmaster-5a708063d73408ce4> I have 15 other regfiles
23:01:42FromDiscord<Elegantbeef> They're all `openArray[int]`
23:02:13FromDiscord<Elegantbeef> Unless the implication is that they can all change inside a single block
23:02:42FromDiscord<Elegantbeef> If that's the case you can cache all of them before hand, which will ofc be tedious to setup but be the exact same logic
23:03:19FromDiscord<@bracketmaster-5a708063d73408ce4> they can all change in a single block
23:03:50FromDiscord<Elegantbeef> Ok so time for macro magic then cause i'm a lazy curmudgen
23:04:26FromDiscord<@bracketmaster-5a708063d73408ce4> hah - its ok. I think you're solution would work quite well if I wasn't doing such a niche thing
23:04:44FromDiscord<Elegantbeef> Nyet, my solution will be used! πŸ˜›
23:04:59FromDiscord<@bracketmaster-5a708063d73408ce4> alrighty then!
23:05:32FromDiscord<@bracketmaster-5a708063d73408ce4> feel free to make a pull request on the simulator once I upstream the diffRegfile implementation
23:05:50FromDiscord<@bracketmaster-5a708063d73408ce4> prefferrably after I get the UART-\>Terminal fully working
23:26:41FromDiscord<pyautogui> NimConf 2021 is going to be interesting. Really looking forward to https://www.youtube.com/Min-implementing-a-programming-languag-with-Nim-(NimConf-2021).
23:27:10FromDiscord<Elegantbeef> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: Well here's what i got https://play.nim-lang.org/#ix=3r8z πŸ˜›
23:27:21FromDiscord<Elegantbeef> Aw shit it doesnt do the defined check
23:28:48FromDiscord<@bracketmaster-5a708063d73408ce4> I should mention that I would need to run regChangeBase at some root level
23:28:54FromDiscord<Elegantbeef> There https://play.nim-lang.org/#ix=3r8B
23:28:58FromDiscord<@bracketmaster-5a708063d73408ce4> regs could be changed throughout many files
23:29:12FromDiscord<Elegantbeef> Ah then this doesnt track each change
23:29:18FromDiscord<Elegantbeef> It just tracks total changes
23:29:35FromDiscord<@bracketmaster-5a708063d73408ce4> well that's fine
23:30:07FromDiscord<@bracketmaster-5a708063d73408ce4> I would probably insert regChangeBase right here\: https://github.com/BracketMaster/nimulatorPPC/blob/main/src/nimulatorPPC.nim#L11
23:30:14FromDiscord<Elegantbeef> Well then this should work
23:30:36FromDiscord<Elegantbeef> When the entire block changes it'll output all the register changes
23:31:12FromDiscord<Elegantbeef> and of course you can use it nested for specific debugging
23:31:12FromDiscord<@bracketmaster-5a708063d73408ce4> the actually reg change statements occur in these files\: https://github.com/BracketMaster/nimulatorPPC/tree/main/src/instructions/implementations
23:31:17FromDiscord<checkersai> sent a code paste, see https://play.nim-lang.org/#ix=3r8C
23:31:36FromDiscord<checkersai> (edit) "https://play.nim-lang.org/#ix=3r8C" => "https://play.nim-lang.org/#ix=3r8D"
23:31:57FromDiscord<checkersai> Also when I run with `nim c -r --gc:arc`
23:31:58FromDiscord<leorize> to check for gcArc you should use `defined(gcArc)`
23:32:08FromDiscord<leorize> compileOption is a bit unreliable at times
23:32:47FromDiscord<Elegantbeef> Yea i think a nice feature is two option strings for start/end message for a sort of stacktrace
23:33:16*supakeen quit (Remote host closed the connection)
23:33:40*supakeen joined #nim
23:34:23FromDiscord<checkersai> In reply to @leorize "to check for gcArc": that still returns false
23:35:57FromDiscord<leorize> do you happen to have a config file that set --gc\:refc? and what Nim version are you using?↡(@checkersai)
23:40:48FromDiscord<Elegantbeef> Well this is my promise to be last change, https://play.nim-lang.org/#ix=3r8F i'm now stopping the progression πŸ˜›
23:41:07FromDiscord<Elegantbeef> If i continue working on this someone needs to ban me πŸ˜€
23:44:27FromDiscord<checkersai> In reply to @leorize "do you happen to": I'm using 1.4.4
23:44:42FromDiscord<checkersai> And to my knowledge I haven't set refc in any config
23:44:46FromDiscord<retkid> Have anyone done stuff with nim in gamebox or unreal
23:46:28fn<ForumUpdaterBot99> New post on r/nim by RattleyCooper: Is there a list of weird nim rules for noobs?, see https://reddit.com/r/nim/comments/o7zflk/is_there_a_list_of_weird_nim_rules_for_noobs/
23:49:47FromDiscord<checkersai> Also I'm on windows currently if that matters
23:50:14FromDiscord<Elegantbeef> What's gamebox
23:50:15FromDiscord<@bracketmaster-5a708063d73408ce4> mordern ones anyways
23:50:20FromDiscord<@bracketmaster-5a708063d73408ce4> 10,000 lines of code so far
23:50:26FromDiscord<@bracketmaster-5a708063d73408ce4> nimulatorPPC is possibly my largest nim project yet
23:50:32FromDiscord<checkersai> oh wait
23:50:35FromDiscord<@bracketmaster-5a708063d73408ce4> CPUs are kinda complex
23:50:45FromDiscord<checkersai> shuffling the argument fixed it
23:50:50FromDiscord<@bracketmaster-5a708063d73408ce4> modern ones anyways
23:51:04FromDiscord<Elegantbeef> Larger than anything i have
23:51:06FromDiscord<@bracketmaster-5a708063d73408ce4> to be fair, I generated the largest files - such as the decoder\: https://github.com/BracketMaster/nimulatorPPC/blob/main/src/isa/bitpat_pairings.nim
23:51:10FromDiscord<checkersai> running `nim c -r --gc:arc .\src\oatmeal.nim` gets the expected behavior
23:51:10FromDiscord<@bracketmaster-5a708063d73408ce4> by manually parsing the POWER manual\: https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv
23:51:39FromDiscord<checkersai> so does `nimble --gc:arc run`
23:51:48FromDiscord<@bracketmaster-5a708063d73408ce4> oh yes - it needs to go before not after
23:51:54FromDiscord<@bracketmaster-5a708063d73408ce4> good catch
23:51:59FromDiscord<@bracketmaster-5a708063d73408ce4> i overlooked that
23:52:09FromDiscord<gogolxdong (liuxiaodong)> @retsyo what are you going to do?
23:52:53FromDiscord<retkid> In reply to @Elegantbeef "What's gamebox": An engine
23:53:04FromDiscord<Elegantbeef> I figured that but i couldnt find anything on it πŸ˜€
23:53:26FromDiscord<leorize> sounds like a nimble and/or compiler bug, you should file an issue for it↡(@checkersai)
23:54:11FromDiscord<retkid> In reply to @Elegantbeef "I figured that but": Think I got the engines name confused in my brain
23:54:53FromDiscord<@bracketmaster-5a708063d73408ce4> before, you were trying to do\: `nim c -r .\src\oatmeal.nim --gc:arc`
23:55:12FromDiscord<@bracketmaster-5a708063d73408ce4> I read in the nim manual that args pass after the file name are passed to the program
23:55:22FromDiscord<@bracketmaster-5a708063d73408ce4> if this is the case - seems like expected behavior?
23:55:39FromDiscord<leorize> yea that's expected if nim was called like that