<< 17-05-2023 >>

00:00:27FromDiscord<Elegantbeef> This tuple based gui seems like it might be the most ideal solution
00:00:33FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4w0J atleast it's extremely easy to declare
00:14:26*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:16:53FromDiscord<Arathanis> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4w0J atleast it's ext": when are you publishing this GUI library?
00:16:57FromDiscord<Arathanis> 😉
00:17:09FromDiscord<Elegantbeef> I mean it'll be apart of truss3D
00:17:13FromDiscord<Arathanis> is it for your game?
00:17:20FromDiscord<Elegantbeef> And it's made specifically for my mind + gamedev
00:17:20FromDiscord<Elegantbeef> Yea
00:17:35FromDiscord<Elegantbeef> Still uncertain if it'll be nice
00:17:42FromDiscord<Elegantbeef> But the logic seems fine
00:17:51FromDiscord<Arathanis> what engine do you use to write it? id be curious to look at game programming in Nim
00:17:58FromDiscord<Elegantbeef> None
00:18:06FromDiscord<Elegantbeef> I use my own framework that uses opengl + sdl2
00:18:09FromDiscord<Elegantbeef> It's very barebones
00:18:16FromDiscord<Arathanis> oohhh rolled your own, even cooler
00:18:29FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/master/examples/guitest.nim#
00:18:31FromDiscord<Arathanis> opengl bindings and sdl2 bindings?
00:19:03FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1108186887044223046/image.png
00:19:07FromDiscord<Elegantbeef> That code powers that gui
00:19:51FromDiscord<Elegantbeef> It does have the basic things like layout groups, text input, drop down, sliders
00:19:52FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1108187092334424074/image.png
00:20:12FromDiscord<Arathanis> any recommended resources for learning about this stuff? like shaders and everything?
00:20:21FromDiscord<Elegantbeef> learnopengl.com
00:20:23FromDiscord<Arathanis> game programming always feels like such an unapproachable monolith
00:20:40FromDiscord<Elegantbeef> I learned a lot of it from Unity and just had to transition that knowledge
00:20:54FromDiscord<Elegantbeef> I did a fair bit of technical art in Unity before learning Nim
00:21:22FromDiscord<Arathanis> oh that is cool, would you recommend starting there? in unity, i mean?
00:21:48FromDiscord<Elegantbeef> Meh it's all the same wherever you go
00:21:57FromDiscord<Elegantbeef> Godot, Unity, Opengl, Shadered it's all the same 😄
00:22:02FromDiscord<Elegantbeef> Shadered might be nice to learn technical art
00:22:07FromDiscord<Elegantbeef> Havent used it myself
00:22:50FromDiscord<Elegantbeef> https://www.jasonbeetham.com/videos/pointrenderer.mp4 was the most cool thing I did in Unity
00:23:33FromDiscord<Arathanis> In reply to @Elegantbeef "https://www.jasonbeetham.com/videos/pointrenderer.m": neat drugs
00:25:19FromDiscord<Elegantbeef> The cool thing about that is it has motion blur
00:25:28FromDiscord<Elegantbeef> Due to the rays being shot out every so often
00:26:43FromDiscord<Arathanis> was that hard to implement?
00:34:00FromDiscord<Elegantbeef> Not really
00:34:13FromDiscord<Elegantbeef> It's a geometry shader that renders a structured buffer every frame
00:34:31*jmdaemon quit (Ping timeout: 240 seconds)
00:34:46FromDiscord<Elegantbeef> It looks nice and fancy when only using geometry colliders, as soon as you add in mesh colliders it explodes though
00:35:26FromDiscord<Elegantbeef> It did have some interesting look when using different textures, probably could do it in screen space with noise
00:36:18FromDiscord<Elegantbeef> screenspace with noise would be much much cheaper as you'd just render the world to a small buffer then render your quads to another buffer using noise to dictate whether to draw a quad and what rotation it has
00:48:55FromDiscord<BoomBang> In reply to @BoomBang "I just meant that": I'll test `parseEval()`
00:49:41FromDiscord<Elegantbeef> Test what?
00:57:19FromDiscord<BoomBang> dangit
00:57:27FromDiscord<BoomBang> Clyde lied
00:58:04FromDiscord<Elegantbeef> Same
01:01:10FromDiscord<BoomBang> i guess ai shouldn't be trusted sometimes
01:01:14FromDiscord<BoomBang> it does guess
01:01:30FromDiscord<Elegantbeef> Of course it shouldnt be
01:01:57FromDiscord<Elegantbeef> Compiler contributors probably know more than AI about an obscure programming language
01:02:02FromDiscord<Elegantbeef> We told you why you cannot do what you want
01:02:13FromDiscord<Elegantbeef> A Nim binary does not have a procedure it does not use
01:03:39*jmdaemon joined #nim
01:12:14*nanxiao joined #nim
01:32:20*krux02 quit (Remote host closed the connection)
02:00:43*nanxiao quit (Quit: Client closed)
02:03:47FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=4w0W
02:05:06FromDiscord<!&luke> im using nim 1.6.4 with nimble 0.13.1
02:05:29FromDiscord<!&luke> although the error is still there with nim 1.6.12
02:10:04FromDiscord<Elegantbeef> You're parsing a json file somewhere
02:14:25FromDiscord<!&luke> Nope
02:14:32FromDiscord<!&luke> Haven’t even imported json
02:14:45FromDiscord<Elegantbeef> Something is parsing a json
02:15:04FromDiscord<!&luke> I’ll send my code, give me a second
02:15:20FromDiscord<!&luke> It compiles fine with nim
02:15:26FromDiscord<!&luke> Just not with nimble
02:15:31FromDiscord<Elegantbeef> Probably an issue with json files inside your `.nimble`
02:15:43FromDiscord<Elegantbeef> delete the json files inside `~/.nimble`
02:16:21*nanxiao joined #nim
02:16:41FromDiscord<!&luke> Oh ok
02:16:45FromDiscord<!&luke> I’ll try that
02:48:49FromDiscord<!&luke> Yea that worked
02:48:51FromDiscord<!&luke> Thanks
03:01:20*cm quit (Ping timeout: 246 seconds)
03:02:11*cm joined #nim
03:20:03FromDiscord<voidwalker> hey @ElegantBeef please take a look at: https://play.nim-lang.org/#ix=4w19 - the concept from last night, any idea why it doesn't match up with the bit vectors ?
03:43:07*nanxiao quit (Quit: Client closed)
03:47:22*greaser|q is now known as GreaseMonkey
03:55:05FromDiscord<michaelb.eth> Maybe beef should setup an online tip jar 😄
03:58:01FromDiscord<voidwalker> I have a theory he is secretely hired to be here by the Nim guys
03:58:32FromDiscord<Elegantbeef> You think someone would pay my dumbass?
03:59:41FromDiscord<voidwalker> I would. It's a worthwhile investment. People are already complaining the community is small. Well, we don't need a big community if we have super helper like beef : D
03:59:49FromDiscord<voidwalker> (edit) "helper" => "helpers"
04:00:52FromDiscord<voidwalker> As for the tip jar, I would pay if I could give $1 at a time without much overhead : P
04:03:51FromDiscord<michaelb.eth> In reply to @Elegantbeef "You think someone would": uh, yeah!
04:04:17FromDiscord<michaelb.eth> it's the ancient art of freelance pay-as-you-go consulting
04:06:48NimEventerNew thread by void09: Help with generics and typeclass problem, see https://forum.nim-lang.org/t/10202
04:07:00FromDiscord<voidwalker> Look what you made me do beef :\
04:07:21FromDiscord<Rika> you need to parenthesise the array or seq
04:07:31FromDiscord<Rika> then you get another error, which im looking into
04:07:40FromDiscord<voidwalker> huh ?
04:08:01FromDiscord<Rika> so this should be in your concept `abv.Base is (array or seq)` it seems, i'm seeing if this is even correct syntax
04:08:15FromDiscord<Rika> but it seems like its correct yes
04:08:48FromDiscord<voidwalker> oh you mean for the concept definition
04:09:11FromDiscord<Rika> im looking into the next error, it reads really strangely
04:09:30FromDiscord<Rika> ah
04:10:45FromDiscord<Rika> so in the `count` proc you need to convert the results of the popcount functions into `uint` without explicit bit count
04:11:11FromDiscord<Rika> but i have to ask, why the variable size uint?
04:11:26FromDiscord<Rika> (edit) "so in the `count` proc you need to convert the results of the popcount functions into ... `uint`type," added "the" | "the`uint` ... without" added "type,"
04:11:36FromDiscord<Rika> (edit) "variable" => "variably"
04:11:48FromDiscord<voidwalker> well, for whatever reason. As the code is now, it seems a bit faster on byte values vs 64bit values, which is surprising
04:11:54FromDiscord<voidwalker> 32bit ones were the slowest
04:12:57FromDiscord<Rika> well, you're the one knowledgeable here so, yeah, but yeah
04:13:26FromDiscord<voidwalker> and why not, flexibility is good
04:14:12FromDiscord<voidwalker> I also want to make "safe" ones, with bounds checking, and unsafe, for max speed
04:15:43FromDiscord<voidwalker> Although not really sure how, maybe define a duplicate type "BitVectorSafe", and check in the procs with "when bv is BitVectorSafe": do bounds check before proceeding
04:16:33FromDiscord<Rika> In reply to @voidwalker "and why not, flexibility": idk its just a common sniff to point out, just in case someone has made an error because they hadnt realised that uint can be 32 bits in 32 bit systems and 64 in 64s
04:17:02FromDiscord<Rika> but, and i mean this legitimately, only you know what you're really doing, i just meant to point it out in case
04:17:57FromDiscord<voidwalker> Actually I don't really know that much what I'm doing, it's a learn as you go type of thing : P
04:18:12FromDiscord<voidwalker> only goal is to join in a single lib as much functionality as possible regarding bitvectors
04:18:23FromDiscord<voidwalker> and look into simd instructions to optimise in some places
04:19:20FromDiscord<voidwalker> so it seems the only problem with my concept was the paranthesis.. lol
04:19:31FromDiscord<Rika> yeah im not knowledgeable in lower level optimisation like that
04:19:56FromDiscord<voidwalker> well it's a simple and old data structure. The popcount code I copied from wikipedia : D
04:20:45FromDiscord<voidwalker> Ok i'm going to go with concept for now, until/if nim forum people can figure an alternative way
04:22:08FromDiscord<voidwalker> Would be nice though if discord had a "virtual" tip jar function, even if just to keep track of tips until a sum large enough to worth transfering accumulates
04:22:51FromDiscord<Elegantbeef> If i wasnt an idiot i'd have setup github sponsor 😛
04:23:36FromDiscord<voidwalker> that's recurring paymnets, for rich people
04:26:18FromDiscord<sOkam!> In reply to @Arathanis "any recommended resources for": learnopengl takes one step, then ten at once when it shouldn't, and then assumes you understood what you did in all those missing explanations (probably didn't, because most stuff is hardcoded as numbers without labels)↵ogldev is much better, 100%
04:27:10FromDiscord<sOkam!> after you finish the beginner section of his tuts, you can go ahead an scrap what you need from opengl. but for starting out, ogldev is way more intuitive and assumes nothing about your existing knowledge
04:27:27FromDiscord<sOkam!> (edit) "opengl." => "learnopengl and any other tuts."
04:28:51*derpydoo joined #nim
04:29:13FromDiscord<sOkam!> @ElegantBeef is the rewrite to trussui ever happening? such that it outputs an image that you can render, instead of rendering auto?
04:29:18FromDiscord<Elegantbeef> To be fair sokam at times you can be a little dense
04:29:30FromDiscord<Elegantbeef> "outputs an image that you can render"?
04:29:33FromDiscord<sOkam!> i am definitely dense af, agreed
04:29:56FromDiscord<sOkam!> slow coder brain issues 😔
04:30:03FromDiscord<Elegantbeef> In theory it should be pluggable
04:30:39FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1l
04:30:43FromDiscord<sOkam!> In reply to @Elegantbeef "In theory it should": kk. haven't looked into it enough. haven't reached that part yet. but hoping I an soon
04:30:52FromDiscord<voidwalker> I still have a problem with the len proc, probably the only one that needs the S parameter present only in one of the types
04:30:53FromDiscord<sOkam!> (edit) "an" => "can"
04:31:07FromDiscord<voidwalker> Error: undeclared identifier: 'AnyBitVecS'
04:31:11FromDiscord<voidwalker> ah nvm
04:31:21FromDiscord<voidwalker> I deleted that type for now
04:31:31FromDiscord<Rika> `typeof(bv).S` should get you the value of S when bv is AnyBitVecS
04:31:46FromDiscord<Rika> i mean, BitVecS
04:32:04FromDiscord<Elegantbeef> Sokam this is the present state of my rewrite, it doesnt function but it's a start https://github.com/beef331/truss3d/blob/guirewrite/src/truss3D/guicomponents/uielements.nim#L34
04:32:19FromDiscord<Elegantbeef> Whoops that was the issue i was going to mention
04:32:25FromDiscord<Elegantbeef> I do presently have `Texture` built in
04:32:33FromDiscord<voidwalker> Error now is ` Error: undeclared identifier: 'S'`
04:32:37FromDiscord<Elegantbeef> In theory though I should be able to abstract it all away
04:32:47FromDiscord<Rika> really? i expected it to work
04:32:47FromDiscord<sOkam!> oh you started it? nice
04:32:49FromDiscord<Elegantbeef> `bv.S`
04:33:09FromDiscord<Rika> In reply to @Elegantbeef "`bv.S`": i thought either would work
04:33:13FromDiscord<Elegantbeef> The main focus is on making the code better to work with for me
04:33:21FromDiscord<Elegantbeef> There is no `S` bound in the proc
04:33:24FromDiscord<sOkam!> In reply to @Elegantbeef "In theory though I": what would be the goal output? just a sequence of color/bytes?
04:33:30FromDiscord<Rika> i meant what i said `typeof(bv).S`
04:33:48FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1m
04:33:56FromDiscord<Elegantbeef> Nah sokam i could make the entire upload stuff procedures
04:33:57FromDiscord<Rika> yeah, i thought that wouldwork
04:34:00FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4w1m" => "https://play.nim-lang.org/#ix=4w1n"
04:34:05FromDiscord<Elegantbeef> That way you could plug in any graphics API you want
04:34:11FromDiscord<voidwalker> this gives ` Error: undeclared field: 'S'`
04:34:25FromDiscord<Rika> try what beef said, bv.S
04:34:27FromDiscord<sOkam!> yeah my concern is because of using it with wgpu
04:34:34FromDiscord<sOkam!> if you figure out a way to make it pluggable, all good
04:34:56FromDiscord<Elegantbeef> The main goal is not plugabillity but it might end up plugable due to my love of generics 😄
04:35:02FromDiscord<sOkam!> 🙂
04:35:20FromDiscord<sOkam!> whats the output format of the ui generation?
04:35:29FromDiscord<Elegantbeef> There is no output
04:35:38FromDiscord<sOkam!> every function has an output
04:35:39FromDiscord<Elegantbeef> Like i said you'd plug a `uploadProc`
04:35:52FromDiscord<Elegantbeef> Nope
04:35:59FromDiscord<Arathanis> In reply to @sOkam! "learnopengl takes one step,": nice, thanks for the resource
04:36:07FromDiscord<Elegantbeef> All I'm defining is going to be the layout/interact logic
04:36:18FromDiscord<Elegantbeef> Rendering should be done in such away you can use any backend/api
04:37:11FromDiscord<Elegantbeef> I like retained mode GUI and static typing
04:37:33FromDiscord<sOkam!> In reply to @Arathanis "nice, thanks for the": if you ever need modern graphics concepts, this tut is invaluable. but definitely not for beginner stuff. you need a couple of months of graphics in your belt to understand it. just bookmark it somewhere↵https://www.youtube.com/watch?v=UVCuWQV_-Es
04:37:48FromDiscord<Elegantbeef> So all i'm really working on is a group of procedures to work on objects that inherit from `UIElement` and tuples that are made of `UIElement`
04:38:16FromDiscord<Arathanis> is there a recommended opengl binding library you would all Recommend?
04:38:20FromDiscord<sOkam!> right, so whats the input to those uploadProc procedures then?
04:38:28FromDiscord<Elegantbeef> the official Nim are fine
04:38:32FromDiscord<sOkam!> In reply to @Arathanis "is there a recommended": the official bindings work well
04:38:36FromDiscord<Elegantbeef> a `UIElement`
04:38:37FromDiscord<sOkam!> nimgl/opengl is not maintained
04:39:01FromDiscord<sOkam!> In reply to @Elegantbeef "a `UIElement`": and what data does that have? that's what i meant by output format
04:39:11FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/guirewrite/src/truss3D/guicomponents/uielements.nim#L28-L35
04:39:50FromDiscord<sOkam!> so you would render each element one by one, if i understand correctly?
04:39:55FromDiscord<Elegantbeef> Nope
04:40:12FromDiscord<Elegantbeef> `proc upload(ui: UiElement, yourBuffer: var T)` is what i'd do
04:40:16FromDiscord<Elegantbeef> So if you use instanced rendering go ham
04:40:21FromDiscord<Elegantbeef> If you use direct rendering same
04:40:23FromDiscord<Arathanis> In reply to @sOkam! "the official bindings work": do they have docs? or do you just use the opengl docs and the function names and signatures are the same?
04:40:36FromDiscord<Elegantbeef> You just use opengl docs
04:40:39FromDiscord<sOkam!> In reply to @Arathanis "do they have docs?": names are the exact same. just follow the usual opengl tuts
04:40:45FromDiscord<Arathanis> sweet deal
04:40:47FromDiscord<Elegantbeef> Opengl is the same everywhere
04:40:48FromDiscord<sOkam!> or official spec
04:41:03FromDiscord<Arathanis> time to go oscillate between feeling like a genious and an idiot
04:41:08FromDiscord<Arathanis> i love learning new complex software stuff
04:41:21FromDiscord<Arathanis> even misspelled genius
04:41:25FromDiscord<Arathanis> well on my way!
04:41:27FromDiscord<Elegantbeef> It's all statically typed Sokam so you just write a basic procedure to upload your GUI
04:41:29FromDiscord<sOkam!> @Arathanis whats your goal? maybe i can recommend something specific if you have specific goals in mind
04:41:40FromDiscord<sOkam!> opengl is a big api, so its very useful to target just what you want
04:42:07FromDiscord<Arathanis> In reply to @sOkam! "<@136570191038513152> whats your goal?": ive always wanted to make a roguelike/roguelite
04:42:29FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1o
04:42:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4w1p
04:43:08FromDiscord<sOkam!> ah the uploadproc doesn't work on the element, thats very different
04:43:26FromDiscord<Elegantbeef> I mean it does work on the element 😛
04:43:38FromDiscord<Elegantbeef> For each element inside a tree it runs
04:43:39FromDiscord<sOkam!> but it can be a tuple. that changes things completely
04:44:32FromDiscord<Elegantbeef> A tuple in my world is just another way to represent a UI tree
04:44:33FromDiscord<sOkam!> so you take care of the layout and interact procs, and then let the user implement the upload one, right?
04:44:41FromDiscord<Elegantbeef> They can implement all three
04:44:50FromDiscord<Elegantbeef> But i have a default one for all UI elements
04:45:01FromDiscord<sOkam!> In reply to @Elegantbeef "A tuple in my": correct. but an element is not a ui tree. so... not knowing that they can be both... changes a lot
04:45:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4w1r
04:45:21FromDiscord<Arathanis> but also it just seems like it would be something to knpw
04:45:22FromDiscord<Arathanis> (edit) "knpw" => "know"
04:45:33FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4w1s
04:45:48FromDiscord<sOkam!> In reply to @Arathanis "ive always wanted to": 2d or 3d? i assume 2d, right?
04:45:51FromDiscord<Rika> did bv.S on its own work without the S generic in the function?
04:46:08FromDiscord<Arathanis> In reply to @sOkam! "2d or 3d? i": id probably start 2d, yeah
04:46:18FromDiscord<sOkam!> then you can stick to gl3
04:46:22FromDiscord<Arathanis> maybe go to 3d eventually, i cant imagine its that much different right?
04:46:31FromDiscord<sOkam!> aka 99% of tutorials out there use opengl3
04:46:33FromDiscord<voidwalker> Hm it seems I can ommit them, strange
04:46:56FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1t
04:47:12FromDiscord<sOkam!> In reply to @Arathanis "maybe go to 3d": slightly, if you want really modern tech. but leave that for future you. if you have a 2d goal, you can learn the api in 2d just fine. all of it is the same, just simpler
04:47:24FromDiscord<sOkam!> (edit) "tech." => "tech is a bit different."
04:47:33FromDiscord<Arathanis> is it not linear algebra all the way down?
04:47:35FromDiscord<Arathanis> :P
04:47:51FromDiscord<sOkam!> ye, but the api for modern 3D is very lacking
04:48:02FromDiscord<sOkam!> for not-so-modern 3d its fine
04:48:19FromDiscord<Elegantbeef> A 2D opengl renderer is very simpler to write
04:48:22FromDiscord<Elegantbeef> simple even
04:48:31FromDiscord<sOkam!> and by lacking i just mean in usability. you can do rendering perfectly fine with it
04:48:39FromDiscord<Elegantbeef> Anyway sokam hopefully you can understand that basically the entire API is plugable and static
04:48:58FromDiscord<Elegantbeef> Did you look at my small impl example?
04:49:16FromDiscord<sOkam!> In reply to @Elegantbeef "Anyway sokam hopefully you": yeah! i was just not understanding how the thing connects to the entire ui and not just one element. but if elements can be tuples, then understood ✍️
04:49:18FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4w0J this thing
04:49:20FromDiscord<Arathanis> well ill start with the tutorial you recommended and get back to you on my goals I think, if you have any recommendations based on what i already said feel free to send them over
04:49:58FromDiscord<sOkam!> In reply to @Arathanis "well ill start with": feel free to @ me here or in #gamedev if you have any questions. been doing ogl stuff for a few months, so its fresh in my mind
04:50:12FromDiscord<Arathanis> In reply to @sOkam! "feel free to @": appreciate it
04:50:53FromDiscord<sOkam!> @Arathanis https://github.com/heysokam/ngl might be useful as a reference, since its all opengl and nim (but uses DSA only, which is the part i mentioned is a bit different)
04:51:35FromDiscord<sOkam!> its overly complex though. so don't let that take away from the motivation. i overengineered the crap out of that thing by my lack of knowledge
04:51:45FromDiscord<Elegantbeef> I did sorta want to do something like sdl2-gpu after trying to help prestige with his problems
04:51:48FromDiscord<sOkam!> (edit) "knowledge" => "knowledge. it should be much simpler"
04:52:31FromDiscord<sOkam!> In reply to @Elegantbeef "I did sorta want": sdl2-gpu? whats that?
04:52:51FromDiscord<Elegantbeef> It's a library that makes a 2d rendering api ontop of sdl
04:52:53FromDiscord<Elegantbeef> It's awful ime
04:53:10FromDiscord<sOkam!> oh just 2d stuffs? didn't know about it
04:53:23FromDiscord<Elegantbeef> Prestige built his game on it and it was convoluted to even try to get a framebuffer to work
04:53:24FromDiscord<Arathanis> In reply to @Elegantbeef "It's awful ime": is "ime" mean "in my estimation"?
04:53:30FromDiscord<Arathanis> (edit) "is" => "does"
04:53:37FromDiscord<Elegantbeef> experience
04:53:43FromDiscord<Arathanis> got it
04:53:45FromDiscord<Elegantbeef> One day i'll actually stop using abbreviations
04:54:07FromDiscord<Rika> input method editor
04:54:13FromDiscord<Arathanis> In reply to @Elegantbeef "One day i'll actually": isnt that technically an initialism?
04:54:47FromDiscord<sOkam!> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4w0J this thing": looks handy. i like it
04:55:07FromDiscord<Elegantbeef> > An abbreviation consisting of the first letter or letters of words in a phrase
04:55:08FromDiscord<Rika> In reply to @Arathanis "isnt that technically an": "same difference"
04:56:12FromDiscord<Elegantbeef> Obviously sokam something like `Grid` would require implementing your own `layout` and likely `interact`
04:59:46FromDiscord<Elegantbeef> Though these may need to be `ref object` .... hmph
04:59:51FromDiscord<sOkam!> by grid you mean like html bootstrap?
05:00:08FromDiscord<sOkam!> https://getbootstrap.com
05:00:16FromDiscord<Elegantbeef> No clue
05:00:17FromDiscord<Elegantbeef> I mean a grid layout
05:00:21FromDiscord<Elegantbeef> Where you have elements in a screen like a video game inventory
05:00:32FromDiscord<sOkam!> oh ic
05:00:50FromDiscord<sOkam!> i thought you meant a responsive grid, not a fixed sized one
05:01:20FromDiscord<Elegantbeef> Meh this is game UI, not like you really need it that responsive in my view
05:01:58FromDiscord<sOkam!> more like slightly adaptive than responsive i guess
05:02:14FromDiscord<sOkam!> just to accomodate for different window sizes a bit
05:02:34FromDiscord<sOkam!> but nothing like web or phone, where literally everything needs to resize well
05:02:44FromDiscord<Elegantbeef> The only layout i'm really concerned with is vertical/horizontal
05:04:16FromDiscord<sOkam!> i guess if its abstracted in a way that you can code your own layout, like you said, it really should be no probl
05:07:27FromDiscord<Elegantbeef> Well you'd be able to write your own elements completely, is the hope
05:09:56FromDiscord<sOkam!> that would be epic
05:12:00FromDiscord<voidwalker> concept can affect runtime performance vs using normal type class ?
05:12:16FromDiscord<Elegantbeef> concepts are generic constraints that is it
05:12:17FromDiscord<Elegantbeef> They do not exist at runtime
05:12:34FromDiscord<voidwalker> welp, then why do I get 10s runtime instead of 10 ms
05:12:47FromDiscord<Rika> try disassembling it first in godbolt or similar
05:12:53FromDiscord<Elegantbeef> You did it wrong
05:13:04FromDiscord<Rika> are you sure you're measuring runtime
05:13:09FromDiscord<Rika> and not compile+run time
05:13:29FromDiscord<Rika> concepts do have a relatively significant impact on compile time
05:13:49FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1x
05:14:09FromDiscord<voidwalker> simply switching between these two (and adjusting S,B generic params on procs so they compile), gets me from 10 to 10.000ms ;\
05:14:28FromDiscord<Elegantbeef> You're doing something wrong
05:14:42FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1y
05:14:58FromDiscord<voidwalker> interestingly, setting values is not affected
05:15:16FromDiscord<Rika> that honestly makes no sense, it shouldnt really affect run time that much
05:15:25FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1z
05:15:25FromDiscord<Rika> how are you measuring?
05:15:28*rockcavera quit (Remote host closed the connection)
05:15:49FromDiscord<voidwalker> well, with timeIt, and also my internal clock that tells me that's not 10ms, but more like 10s
05:16:13FromDiscord<Rika> yes but i mean
05:16:18FromDiscord<Rika> what commands are you running
05:16:26FromDiscord<Rika> that you are timing
05:16:34FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1A
05:16:39FromDiscord<voidwalker> first two loops with setting values are not affected
05:17:00FromDiscord<Rika> are you measuring the time iwthin the code?
05:17:14FromDiscord<voidwalker> huh ?
05:17:21FromDiscord<Rika> ah waittimeit
05:17:24FromDiscord<Rika> (edit) "waittimeit" => "wait timeit yeah you are"
05:17:30FromDiscord<Rika> nevermind i was thinking in python somehow
05:17:42FromDiscord<voidwalker> I measured for each loop as well, and it is ~10 us, instead of <=1 us
05:17:58FromDiscord<Rika> i can only really recommend disassembly...
05:18:31FromDiscord<hdbg> Or vieweing generated code
05:31:21FromDiscord<voidwalker> https://godbolt.org/z/5P7Wv7sza
05:32:10FromDiscord<voidwalker> can't figure out how to find the code generated for the last line
05:32:41FromDiscord<that_dude> You are compiling in release right?
05:33:12FromDiscord<voidwalker> hm no, but I was compiling with debug before and it was fast
05:33:35FromDiscord<that_dude> iirc gcc optimizations don't get applied with debug
05:34:05FromDiscord<voidwalker> hm okay it is fast again with release
05:34:35FromDiscord<voidwalker> but why does this happen when using concept, and why 1000x slowdown
05:35:03FromDiscord<Elegantbeef> It's not the concept
05:35:06FromDiscord<Elegantbeef> It's what the code is doing
05:35:24FromDiscord<that_dude> No clue about that tbh. I just know that measurements are better done in release or danger
05:35:48FromDiscord<voidwalker> oh wait, maybe with release it optimizes a for i in 0..1_000_000 discard value to.. nothing ?
05:36:05FromDiscord<voidwalker> cause it runs in 979 ns for 20 million iterations lol
05:36:21FromDiscord<Rika> its possible, yes
05:36:21FromDiscord<voidwalker> (edit) "20" => "2"
05:36:59FromDiscord<that_dude> https://github.com/treeform/benchy has a keep proc. May help avoid some things getting removed
05:40:37NimEventerNew thread by domogled: Std/paths and $ proc, see https://forum.nim-lang.org/t/10203
05:40:57FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1D
05:41:12FromDiscord<voidwalker> first one takes forever, (10+ seconds idk), while second form is instant. what happens ?
05:41:54FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4w1D" => "https://play.nim-lang.org/#ix=4w1E"
05:45:05FromDiscord<Arathanis> @sOkam! do you need to install the official bindings for opengl?
05:46:27FromDiscord<Arathanis> looks like that is a yes
05:49:47*junaid_ joined #nim
05:53:25*junaid_ quit (Remote host closed the connection)
05:54:05FromDiscord<sOkam!> In reply to @Arathanis "<@186489007247589376> do you need": yep. `nimble install opengl`↵or just add `requires "opengl"` in your nimble file
05:58:44FromDiscord<Arathanis> In reply to @sOkam! "yep. `nimble install opengl`": sweet.
05:59:06FromDiscord<Arathanis> whats the best way to coerce argc and argv into the ptr cint and pointer that glutInit expect?
05:59:32FromDiscord<sOkam!> i would recommend glfw instead of glut
05:59:54FromDiscord<Arathanis> ah, the tutorial you sent me opened with glut haha, should i skip that one?
05:59:56FromDiscord<sOkam!> or even `windy`, which might be simpler to start with (although a bit more lacking in tuts)
06:00:06FromDiscord<Elegantbeef> sdl2, windy, gflw, anything but glut
06:00:09FromDiscord<Elegantbeef> Or even glew
06:00:12FromDiscord<sOkam!> pretty much
06:00:32FromDiscord<Elegantbeef> I think glew is better i cannot remember
06:00:35FromDiscord<sOkam!> In reply to @Arathanis "ah, the tutorial you": yeah, just take a `hello window` from glfw or windy, and fuck glut
06:00:44FromDiscord<sOkam!> its outdated af
06:01:03FromDiscord<Arathanis> got it, are sdl2, windy, gflw, etc all other libraries i should install?
06:01:08FromDiscord<Arathanis> well, pick 1 and install
06:01:40FromDiscord<sOkam!> yeah just one of them
06:01:51FromDiscord<sOkam!> windy is like the glut of nim
06:02:16FromDiscord<Arathanis> would either of you recommend one over the others?
06:02:17FromDiscord<sOkam!> glfw gives more freedom/control, but also less abstraction. not much though
06:02:22FromDiscord<Elegantbeef> I use sdl2
06:02:27FromDiscord<Elegantbeef> I'm lazy and it works well
06:03:15FromDiscord<sOkam!> In reply to @Arathanis "would either of you": i like glfw the most, i don't like the idea behind sdl2/glut/windy and similars. i would rather have the extra control↵but its either glfw/windy for me as a recommendation. just choose what you find more comfy
06:03:55FromDiscord<Arathanis> recommended library for the bindings for those two options?
06:04:01FromDiscord<Arathanis> ill take a look at both and pick one
06:04:07FromDiscord<sOkam!> most up to date glfw bindings I know of: https://github.com/heysokam/nglfw↵windy is @https://github.com/treeform/windy
06:04:29FromDiscord<sOkam!> nimgl/glfw was popular a while back, but its very much abandoned for 2y
06:04:58FromDiscord<Arathanis> a lot of otherwise cool looking nim libraries are abandonware :/
06:04:59FromDiscord<sOkam!> both of those repos have a hello window example in the `examples` folder, so you can compare
06:09:51FromDiscord<JJ> anything treeform is unlikely to be abandonware
06:10:12FromDiscord<JJ> reminds me i really need to actually get my project with windy and pixie working again though
06:22:40*nanxiao joined #nim
06:39:52FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1J
06:41:48FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4w1J" => "https://play.nim-lang.org/#ix=4w1O"
06:59:15FromDiscord<Rika> Wow that’s slow, but, 105 seconds?
07:03:23FromDiscord<voidwalker> yeah idk timeit bugs, I will try to switch to benchy
07:04:09FromDiscord<voidwalker> Ok so the C code is indeed very hairy and a total spaghetti monster, no chance of me figuring out what goes on there
07:05:04FromDiscord<Rika> There are a set of compiler options you can activate to make it easier to read the C code but I don’t know them, gotta ask beef for that hahaha
07:05:21FromDiscord<Rika> I know that using danger, and using ARC will make it cleaner in C code
07:05:31FromDiscord<voidwalker> already switched to danger
07:05:32FromDiscord<Elegantbeef> `-d:danger --mm:arc` is all I do
07:05:49FromDiscord<Rika> I was under the impression that there were more options
07:05:55FromDiscord<voidwalker> https://play.nim-lang.org/#ix=4w1S
07:06:18FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w1T
07:07:42FromDiscord<voidwalker> and yeah I checked, it actually does the job of setting the bits
07:07:49FromDiscord<Rika> Yeah benchmarking is a bit finicky because of the optimisations, maybe use the tree form library because of the keep template
07:07:53FromDiscord<Rika> Oh really
07:08:43FromDiscord<voidwalker> oh wait
07:09:06FromDiscord<voidwalker> i'm blind, not enough coffee, i had i mod 2, instead of bv2[i] mod 2
07:10:06FromDiscord<voidwalker> so the getter `[]` proc is fcked somehow
07:10:18FromDiscord<voidwalker> writing values = fast, reading them = super slow
07:11:28FromDiscord<voidwalker> but only if using concept, if I use the normal typeclass it's okay
07:22:27*Notxor joined #nim
07:24:28FromDiscord<voidwalker> well, copied some clean code in another file where I had the concept version, and it runs fast there.. now to diff it
07:32:07FromDiscord<voidwalker> ah nvm it doesn't
07:36:20FromDiscord<voidwalker> concept code: https://play.nim-lang.org/#ix=4w1X typeclass code: https://play.nim-lang.org/#ix=4w1Y
07:38:56*azimut quit (Ping timeout: 240 seconds)
07:41:27FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4w20
07:41:47FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4w20" => "https://play.nim-lang.org/#ix=4w21"
07:42:58FromDiscord<voidwalker> var numbers = (0..16).toSeq
07:43:23FromDiscord<Rika> 0u8..16u8
07:43:30FromDiscord<voidwalker> (edit) "(0..16).toSeq" => "(0'u8..16'u8).toSeq"
07:43:33FromDiscord<Rika> Need to put suffix for type
07:43:33FromDiscord<voidwalker> forgot : P
07:44:05FromDiscord<voidwalker> oh it works without the `
07:44:29FromDiscord<voidwalker> (edit) "`" => "'"
07:44:58FromDiscord<voidwalker> would it be very rude if I asked about my problem in #internals ? : P
07:45:47FromDiscord<Rika> Which one
07:45:55FromDiscord<Rika> Oh the performance
07:46:17FromDiscord<voidwalker> well, the current one is why tf does it take 19 minutes to access values in a bit array if using a concept type
07:46:18FromDiscord<Rika> We can always ping the optimisation pros here
07:46:32FromDiscord<Rika> In reply to @voidwalker "well, the current one": Okay then I’d say sure post it
07:46:51FromDiscord<voidwalker> I just hope I am not blind again and make a fool of myself
07:47:20FromDiscord<voidwalker> who can we ping ?
07:49:35*lucasta quit (Remote host closed the connection)
07:58:41FromDiscord<Rika> In reply to @voidwalker "concept code: https://play.nim-lang.org/#ix=4w1X ty": @mratsim sorry but we’re at a loss in terms of figuring out the performance issues from this
07:59:56*nanxiao quit (Quit: Client closed)
08:09:08*nanxiao joined #nim
08:39:55FromDiscord<sOkam!> easy enough, thanks. didn't know ranges have a toSeq proc
08:47:04FromDiscord<least antisemitic pole> nimsuggest memory improvements when? 😔
08:49:45FromDiscord<least antisemitic pole> In reply to @sOkam! "easy enough, thanks. didn't": you can use `toSeq` on anything that can be iterated over tbh
08:50:58FromDiscord<sOkam!> true that. never thought about it that way
08:51:42FromDiscord<Elegantbeef> So it has started to be pluggable https://github.com/beef331/truss3d/blob/guirewrite/src/truss3D/guiimpl.nim 😄
08:53:10FromDiscord<Elegantbeef> Only the base system can be pluggable though, so might not be worth the trouble 😄
09:18:12FromDiscord<jmgomez> The API looks good beef, I dont like the `i` in `UiX`though
09:23:18*Guest74 joined #nim
09:25:46FromDiscord<Elegantbeef> What should it be a `W`?
09:26:56FromDiscord<Elegantbeef> I personally do not like any prefixing so I do agree though ax the entire `Ui` prefix
09:28:01FromDiscord<jmgomez> I would rather make it capital, get rid of it or get rid of the whole prefix
09:28:41FromDiscord<jmgomez> (edit) "capital," => "upper case,"
09:30:00FromDiscord<Elegantbeef> Oh yay pointless uppercasing
09:30:31*Guest74 quit (Quit: Client closed)
09:30:34FromDiscord<Elegantbeef> This is Nim afterall you can use the incorrect spelling and be wrong in silence
09:31:00FromDiscord<Elegantbeef> Plus it's not like one actually needs to write `UiElement` more than once
09:31:50FromDiscord<Elegantbeef> I might be too sassy given that it's too late, so buh bye
09:56:37*nanxiao quit (Quit: Client closed)
10:00:03FromDiscord<jmgomez> Oh virtual just got merged into devel 😁
10:02:24FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4w2v
10:03:22FromDiscord<demotomohiro> Consts in NimNode tree returned from `macros.getImpl`
10:04:11*derpydoo quit (Read error: Connection reset by peer)
10:05:43FromDiscord<jmgomez> I’m on the phone but maybe by not using a literal works?
10:21:34FromDiscord<demotomohiro> In reply to @jmgomez "I’m on the phone": Declaring `let SomeConst = 1` instead of `const SomeConst = 1` works.↵But I cannot do that because I want to get proc body from modules in other libraries.
10:24:54FromDiscord<jmgomez> I meant calling a function to get 1 instead of assigning it. The replacement sounds to be done before the NimNodes are created. But if you don’t control the body probably there is no way around it
10:24:55FromDiscord<voidwalker> @demotomohiro thank you for the forum reply, you saved my sanity. I wonder if there is any other way to do it though
10:31:22FromDiscord<demotomohiro> In reply to @jmgomez "I meant calling a": Maybe this is impossible. I need to use `typed` parameter to use `getImpl` but that means symbol lookup are performed to the proc body.↵Anyway, thank you for your help!
10:35:52FromDiscord<demotomohiro> In reply to @voidwalker "<@288750616510201856> thank you for": You can implement `proc []()` for `BitVecS` and `BitVec` separately but they will have almost same code.↵I don't know any better other way.
10:36:17FromDiscord<voidwalker> well, the whole point was to not have separate implementations
10:37:25FromDiscord<voidwalker> Well, I can continue my work now, I will maybe submit it to some experts for code review further on : )
11:07:18*Notxor quit (Remote host closed the connection)
11:30:59*dza quit (Quit: )
11:32:22*dza joined #nim
11:33:23*dza quit (Client Quit)
11:34:45*dza joined #nim
12:02:01*dza quit (Quit: )
12:03:24*dza joined #nim
12:21:07FromDiscord<voidwalker> Is there some syntax limitation with generics so that I can do `toBitVector[uint32]("lol")` but not `"lol".toBitVector[uint32]` ? it tells me it cannot instantiate the generic param
12:23:41FromDiscord<Rika> Add a colon before the generic type
12:23:46FromDiscord<Rika> Yes it’s a syntax limitation
12:27:42FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w2U
12:29:25FromDiscord<voidwalker> does this look good ? It's suggested to use openArray[byte] for lowest level implementation and use other procs to convert to openArray byte ?
12:30:18FromDiscord<Rika> Seems fine to me, what are your concerns exactly
12:30:26FromDiscord<voidwalker> that I'm doing it wrong : P
12:32:35FromDiscord<voidwalker> can I define 2+ type names to share the same definition, on the same line ? like you do with vars
12:32:45FromDiscord<voidwalker> (edit) removed "like you do with vars"
12:33:00FromDiscord<Rika> No I don’t think so
12:33:36FromDiscord<voidwalker> then type alias it is
12:34:50FromDiscord<mratsim> In reply to @Rika "<@570268431522201601> sorry but we’re": Will have a look
12:41:57FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w32
12:42:18FromDiscord<voidwalker> this causes no compile errors but I get `execution of an external program failed:`
12:42:47FromDiscord<voidwalker> `./bitvec' terminated by signal SIGSEGV (Address boundary error)`
12:52:23FromDiscord<voidwalker> well, this is very strange indeed
12:52:34FromDiscord<gcao> hi, in asyncdispatch we have this proc:↵proc addTimer(timeout: int; oneshot: bool; cb: Callback)↵if oneshot is false, the timer will run periodically, how do we stop the timer?↵The Callback returns a boolean, if it returns false, will it stop the timer to run further?
12:52:39FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4w33
12:53:36FromDiscord<voidwalker> if I have i from `0..32` or larger, it causes sigsegv. ; o
12:53:40FromDiscord<gcao> In reply to @gcao "hi, in asyncdispatch we": By reading the source code, it doesn't look like so. However there should be a way to stop the timer I suppose
12:53:41FromDiscord<Piko> what's the simplest way to pass an object literal to a JS function from nim? suppose I want to execute `something({foo: true, bar: 42})`
12:53:43FromDiscord<albassort> is there any wholeistic portable mingw + nim
12:53:46FromDiscord<albassort> (edit) "is there any wholeistic portable mingw + nim ... " added "thing"
12:54:18FromDiscord<albassort> i wanna develop nim but i cant do that because my employer will notice so much shit on my work computer
12:54:41FromDiscord<albassort> maybe I'll buy a second laptop for dev work
12:55:00FromDiscord<albassort> (edit) "maybe I'll buy a second laptop for ... dev" added "personal"
13:01:05FromDiscord<Piko> In reply to @albassort "is there any wholeistic": have you tried choosenim? it downloads the compiler automatically and puts everything in $HOME/.choosenim and $HOME/.nimble, then you can use windows' cmd as console
13:02:02FromDiscord<Piko> not exactly portable, but it wouldn't be hard to make it portable either, I think... maybe with a .bat script that sets the PATH of those
13:02:32FromDiscord<voidwalker> you want to develop at work ? or you don't have your own computer ?
13:12:20FromDiscord<albassort> In reply to @Piko "have you tried choosenim?": for windows
13:13:01FromDiscord<Piko> yeah by $HOME I mean C:\Users\your_username\
13:13:05FromDiscord<albassort> In reply to @voidwalker "you want to develop": i dont want my boss to yell at me for installing things on my pc that might compromise security even though nim certainly wont
13:13:17FromDiscord<least antisemitic pole> recursive imports always lead to some very confusing errors in my experience
13:13:23FromDiscord<least antisemitic pole> they should probably be disabled until they're ready tbh
13:14:05FromDiscord<Piko> choosenim doesn't generate any start menu icon or entry in add/remove programs
13:16:37FromDiscord<albassort> In reply to @least antisemitic pole "recursive imports always lead": no they're pretty simplw
13:16:43FromDiscord<albassort> everything just stops working
13:20:08FromDiscord<Rika> In reply to @albassort "i dont want my": ? do you know it certainly wont
13:20:58FromDiscord<voidwalker> omfg bosses can yell at you ?
13:22:06FromDiscord<voidwalker> https://play.nim-lang.org/#ix=4w37 - can anyone figure why this SIGSEGVS, unless line #5 is commented ? Which is just a type alias that never gets used in the code ..
13:22:40FromDiscord<voidwalker> the last lines in the code with the for i 0..32, if i<32 it doesn't crash
13:57:04*rockcavera joined #nim
13:58:39FromDiscord<@theperfectcomputer-628303036da0> in Python, you can convert a string to a Path
13:58:42FromDiscord<@theperfectcomputer-628303036da0> Is there a similar concept for Nim?
14:02:19*progranner joined #nim
14:03:39FromDiscord<Nerve> If I'm remembering correctly, paths in Nim are always handled as strings. What `std/os` provides is a number of procs which can interpret and manipulate path strings so you can be sure they're valid and platform-appropriate.
14:03:42*progranner quit (Client Quit)
14:04:01FromDiscord<Nerve> In addition there's the `/` macros as a path constructor.
14:04:05FromDiscord<Nerve> (edit) "macros" => "macro"
14:04:11FromDiscord<@theperfectcomputer-628303036da0> ok - makes sense
14:04:43Amun-Rathere are a few 3rd party pathliblike modules, https://github.com/achesak/nim-pythonpathlib
14:04:46FromDiscord<Rika> Nim has a library that uses distinct types for paths
14:04:57FromDiscord<Rika> But it is in the development version of Nim
14:05:12Amun-Rawell, that one is pretty old
14:13:00*progranner joined #nim
14:14:20NimEventerNew post on r/nim by MetaMindWanderer: Purpose of NimScript vs nim, see https://reddit.com/r/nim/comments/13k2z3d/purpose_of_nimscript_vs_nim/
14:14:24FromDiscord<@theperfectcomputer-628303036da0> when should I define a ref object type as opposed to just an object?
14:22:00*xet7 joined #nim
14:23:08FromDiscord<Nerve> In reply to @@theperfectcomputer-628303036da0 "when should I define": It's required for variant types, and that's the only thing I've needed it for so far. Since non-ref objects are basically just structs allocated on the stack, I would think that for other cases, that you might want a managed reference to an object on the heap if the calling scope is going to close but the object needs to stick around due to references in other places.
14:23:22FromDiscord<Nerve> (edit) removed "that"
14:27:29FromDiscord<demotomohiro> In reply to @voidwalker "https://play.nim-lang.org/#ix=4w37 - can anyone": It seems your code works on Nim playground when the length of bv1 and bv2 are reduced.
14:29:45FromDiscord<demotomohiro> @theperfectcomputer↵It is a question people frequently ask:↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark
14:36:13FromDiscord<voidwalker> @demotomohiro I had a feeling it's related to stack size being consumed or something like that. So maybe that type definition makes it overflow or something ? weird coincidence
14:37:02*jmdaemon quit (Ping timeout: 265 seconds)
14:38:26FromDiscord<Rika> In reply to @Nerve "It's required for variant": it is not required for variant types. it is (kinda) required for inheritance though
14:39:20FromDiscord<demotomohiro> In reply to @voidwalker "<@288750616510201856> I had a": Variables outside of procedures don't use stack. They are stored on static storage.
14:39:41*Notxor joined #nim
14:41:49FromDiscord<demotomohiro> And why dont you use bitops or math module?
14:43:16FromDiscord<voidwalker> bitops is for integer bit manipulation, not for arrays of bits
14:49:14FromDiscord<demotomohiro> So `count` in your code count set bits different way?
14:49:41FromDiscord<mratsim> In reply to @voidwalker "omg, what side effects": You should use ceil division for the capacity of your bitvector.↵↵i.e. ceildiv(a, b) = (a+b-1) div b
14:49:44FromDiscord<voidwalker> count is for counting how many 1 bits are i n the structure
14:50:12FromDiscord<voidwalker> I implemented code I found on wikipedia for that : D, for bytes and 64bit for now
14:50:44FromDiscord<voidwalker> @mratsim thanks but I don't want to import a module for 1 line of code..
14:51:15FromDiscord<mratsim> Why a module? Just put it in your code
14:51:31*xet7 quit (Ping timeout: 240 seconds)
14:51:50FromDiscord<mratsim> Using div and mod at compile time will make compilation slow. Those are 55 times slower than addition.
14:51:52FromDiscord<voidwalker> that could be a good idea
14:52:36FromDiscord<voidwalker> @mratsim while you're here, I have some code dillemas, similar to the one Rika pinged you earlier (the huge slowdown when using concept)
14:53:19FromDiscord<voidwalker> https://play.nim-lang.org/#ix=4w37 - this SIGSEGVS after I added line 5 with the type alias. It is fixed if I reduce the size of the bitarrays in the code (which are very large)
14:53:25FromDiscord<voidwalker> any idea what's going on ?
14:54:28FromDiscord<voidwalker> Also, if I reduce the size of those arrays and keep the type alias, I get a huge slowdown again, 6 seconds vs 86ms without it
14:55:10FromDiscord<demotomohiro> In reply to @voidwalker "count is for counting": Is your `count` faster than Nim's stdlib countSetbits?↵https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/countbits_impl.nim
14:55:14FromDiscord<voidwalker> https://play.nim-lang.org/#ix=4w3C
14:55:59FromDiscord<voidwalker> looks to the be the same algorithm for 64bit int. I don't have one for 32bit, maybe I will copy that one, thanks
14:56:29FromDiscord<mratsim> In reply to @Rika "<@570268431522201601> sorry but we’re": Use getMonotime for benchmarking and create benches for individual proc.↵↵Then disassemble either through Intel VTune or Apple Instruments or by using Ghidra.
14:57:32FromDiscord<mratsim> In reply to @voidwalker "Also, if I reduce": Slowdown for compilation or something else?
14:57:39FromDiscord<voidwalker> for running
14:57:57FromDiscord<mratsim> In reply to @voidwalker "https://play.nim-lang.org/#ix=4w37 - this SIGSEGVS": Your fastLog2 is using 63 instead of 31 for uint32 btw
14:58:45FromDiscord<voidwalker> I haven't yet gotten to verifying that part, it's stolen from another bitvector lib
14:58:54FromDiscord<mratsim> Mmmmh in the past concept had a parameter passing issue. Maybe it's back?
14:59:24FromDiscord<voidwalker> you sure it must be 31 ?
14:59:51FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/16897
15:00:46FromDiscord<mratsim> In reply to @voidwalker "you sure it must": Compare with bitops or stew bitops2
15:01:33*azimut joined #nim
15:04:01FromDiscord<voidwalker> https://github.com/nim-lang/Nim/blob/f222625b17f90238cf7a31fec2d1b31447b6cd22/lib/pure/bitops.nim#LL381C1-L381C46 - this looks to be a different method ?
15:06:51FromDiscord<mratsim> In reply to @voidwalker "https://github.com/nim-lang/Nim/blob/f222625b17f902": Line 585
15:09:21FromDiscord<voidwalker> ok, I changed it, will test that part eventually. It is used to turn int to bit array.. I wonder if it's not simpler just to copy the memory
15:09:48om3gadear all, maybe I don't understand something, but how it is possible that GC reports .[Heap] total number of bytes: 876156054, while in top I see the process utilizes 1.8GB?
15:10:52Amun-Rado you allocate any non-gc memory?
15:10:57om3gathe info I got using dumpNumberOfInstances(), and gc is refc
15:11:13*xet7 joined #nim
15:11:22om3gaAmun-Ra: no, it's wsl, maybe because of that?
15:11:27FromDiscord<voidwalker> @mratsim about the super slowdown, here is the code sample: https://play.nim-lang.org/#ix=4w3R - comment line #7 and it goes from 6seconds to 60ms or something
15:11:34FromDiscord<voidwalker> 100x slowdown
15:11:40FromDiscord<TuxTheArchUser> Is it possible to use Nim on microcontrollers?
15:11:41Amun-Raom3ga: ah, I'm not familiar wih wsl
15:11:43FromDiscord<voidwalker> for the operation on line 132
15:12:05FromDiscord<Rika> In reply to @TuxTheArchUser "Is it possible to": yes
15:12:05om3gaAmun-Ra: it shoul be "like linux"
15:12:12FromDiscord<Rika> plenty of people do
15:12:18FromDiscord<jmgomez> Is the manual and experimental manual published somewhere for devel?
15:12:20FromDiscord<Rika> see #embedded
15:12:25Amun-Raom3ga: yes, "like" ;)
15:12:32om3gaAmun-Ra: I will check on normal os then, to exclude possible side effects
15:12:40FromDiscord<TuxTheArchUser> In reply to @Rika "yes": Is CH32V203C8T6 supported?
15:13:05FromDiscord<TuxTheArchUser> It's RISC-V cheap chinese microcontroller
15:13:13FromDiscord<Rika> In reply to @jmgomez "Is the manual and": https://nim-lang.github.io/Nim/manual.html https://nim-lang.github.io/Nim/manual_experimental.html
15:13:37FromDiscord<Rika> In reply to @TuxTheArchUser "Is CH32V203C8T6 supported?": does it have a C compiler? then technically it is, might need a lot of setup work though
15:14:01FromDiscord<TuxTheArchUser> In reply to @Rika "does it have a": It supports C
15:14:40FromDiscord<jmgomez> In reply to @Rika "https://nim-lang.github.io/Nim/manual.html https://": nice, thanks Rika!
15:15:22FromDiscord<albassort> In reply to @TuxTheArchUser "It's RISC-V cheap chinese": Risc-V isn't cheap and chinese, wasn't it designed in western academia?
15:15:41Amun-RaCH32 is cheap
15:15:46FromDiscord<TuxTheArchUser> I mean MCU itself is chinese
15:16:00FromDiscord<TuxTheArchUser> RISC-V is just instruction set
15:16:40FromDiscord<albassort> from Berkley
15:16:51FromDiscord<Rika> lol
15:16:51FromDiscord<TuxTheArchUser> What-
15:17:01FromDiscord<TuxTheArchUser> Isn't WCH chinese company?
15:17:21FromDiscord<albassort> cheap things are good because computing should be cheap, and power efficient.
15:17:28FromDiscord<Rika> they just misunderstood
15:17:29FromDiscord<TuxTheArchUser> Yeah
15:17:38FromDiscord<TuxTheArchUser> In reply to @Rika "they just misunderstood": Okayy
15:17:44FromDiscord<Rika> how expensive is the chip btw
15:17:51FromDiscord<TuxTheArchUser> 10 cents
15:17:56FromDiscord<Rika> daaaaaaaamn
15:18:27FromDiscord<TuxTheArchUser> And it has 144MHz RV32GC core XD
15:18:39FromDiscord<Rika> single?
15:18:43FromDiscord<TuxTheArchUser> Yeah
15:18:49FromDiscord<TuxTheArchUser> But it costs only 10 cents XD
15:18:56FromDiscord<Rika> built in ram?
15:18:59FromDiscord<TuxTheArchUser> Yeah
15:19:05FromDiscord<Rika> wait ig its an mcu ofc it does
15:19:15FromDiscord<Rika> flash?
15:19:19FromDiscord<TuxTheArchUser> Yeah
15:19:41FromDiscord<Rika> 20k sram for ten cents a pop wow
15:19:46FromDiscord<TuxTheArchUser> Yeah
15:19:57FromDiscord<Rika> two usb interfaces???
15:20:02FromDiscord<TuxTheArchUser> Yeah
15:20:19FromDiscord<Rika> idk wow this is cheap as heck
15:20:21FromDiscord<TuxTheArchUser> WCH makes cheap and crazy stuff
15:22:00FromDiscord<TuxTheArchUser> That's the only MCU that I can buy XD
15:25:00om3gabut is is slow
15:25:19om3gaarm socs are faster
15:26:10FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> about the super": Strange, compare the C files, there must be a glaring issue there. Have to fetch my kid and then entertain her so no time until she sleeps.↵↵Open an issue in the Nim repo.
15:26:51FromDiscord<voidwalker> I'd wanted for someone to check it first before opening an issue, as I have no idea what's going on there
15:27:15FromDiscord<voidwalker> No rush, I was just holding it in case there's an unknown compiler bug related to this.. what are the odds
15:32:04FromDiscord<@theperfectcomputer-628303036da0> I'm running Nim on windows, and seem to get stuck waiting for process to exit - code below\:↵↵let myProc = startProcess("git", args = ["diff", "HEAD\~1"], options = {poUsePath})↵discard myProc.waitForExit()
15:32:48FromDiscord<@theperfectcomputer-628303036da0> If I replace that wait with sleep 300 for example, things work fine
15:33:01FromDiscord<@theperfectcomputer-628303036da0> On Linux, things work fine
15:33:12FromDiscord<Arathanis> In reply to @@theperfectcomputer-628303036da0 "I'm running Nim on": try running `git --no-pager diff`
15:33:44FromDiscord<Prestige> Using karax, is there a way to change the generated files? Like everything is app.html, app.js, the generated title of the page is `app`. I don't see anything in the docs about being able to change this
15:35:21FromDiscord<@theperfectcomputer-628303036da0> Still no go↵(@Arathanis)
15:38:45*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:46:46*Notxor quit (Remote host closed the connection)
15:51:53FromDiscord<demotomohiro> @theperfectcomputer if you want git diff takes input from terminal use `poParentStreams` option.
15:54:53*progranner joined #nim
16:22:44*Notxor joined #nim
16:24:17FromDiscord<Bung> what's the correct way import `compiler` on devel, my project works fine before, now `Error: cannot open file: compiler/ast`
16:25:17*xet7 quit (Quit: Leaving)
16:28:55*cnx quit (Remote host closed the connection)
16:29:44*cnx joined #nim
16:30:41FromDiscord<Bung> nvm
16:42:57*krux02_ joined #nim
16:56:54*xet7 joined #nim
17:09:04FromDiscord<auxym> In reply to @Bung "what's the correct way": https://forum.nim-lang.org/t/10191
17:11:59FromDiscord<Bung> oh, thanks!
17:20:22*xet7 quit (Remote host closed the connection)
17:21:25*GreaseMonkey quit (Quit: No Ping reply in 180 seconds.)
17:22:42*greaser|q joined #nim
17:30:03*dza quit (Quit: )
17:31:27*dza joined #nim
17:32:22*Notxor quit (Quit: Leaving)
17:58:37FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4w4k
17:58:56FromDiscord<Dudugz> First I used get it returned an empty seq, then I used .sqlString and it was empty :v
18:04:39FromDiscord<Dudugz> I mean, there is data in the database but I am getting an empty seq
18:10:53FromDiscord<Dudugz> I activated debug, surprisingly it is not able to identify that the field name is a text and tries to parseFloat https://media.discordapp.net/attachments/371759389889003532/1108456620524048504/image.png https://media.discordapp.net/attachments/371759389889003532/1108456620784103444/image.png
18:16:37FromDiscord<Dudugz> -.- so that's why i had to install maria even setting MySQL as driver https://media.discordapp.net/attachments/371759389889003532/1108458066124492892/image.png
18:17:10FromDiscord<jmgomez> I only used it like once but IIRC it should accept a schema/type def
18:19:52FromDiscord<Dudugz> yea no, it doesn't work
18:20:33FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4w4p
18:20:41FromDiscord<Dudugz> (edit)
18:21:46FromDiscord<Dudugz> the problem is that looking at the allographer code all mysql methods were replaced by mariadb as if they were the same. That's probably what's causing the conflict, it thinks it's a float when it's actually text.
18:22:37FromDiscord<jmgomez> I mean did you setup the scheme like this: https://github.com/itsumura-h/nim-allographer/blob/main/example/setup.nim
18:24:40FromDiscord<Dudugz> well no? why i would create a table that already exists
18:24:42FromDiscord<Dudugz> https://media.discordapp.net/attachments/371759389889003532/1108460098415755284/image.png
18:26:48FromDiscord<jmgomez> I dont know ask the persons who wrote the library but if that's their examples and you dont follow them dont expect it to work magically
18:27:24FromDiscord<Dudugz> But this example you showed is to create a table lol, the example in the readme is a simple select, which doesn't work.
18:27:44FromDiscord<Dudugz> https://media.discordapp.net/attachments/371759389889003532/1108460864526373016/image.png
18:29:42FromDiscord<jmgomez> I dont know were the mapping is done but obviously some mapping has to be done if it does it automatically for you it means it uses an intermediate type. Is that the case?
18:30:32FromDiscord<Dudugz> hm, i'll try
18:30:46FromDiscord<Dudugz> it just feels weird, you already had the table mapped in the db
18:31:55FromDiscord<Dudugz> i mean, for NoSQL you would really need a mapping, for SQL not since all columns are typed.
18:33:19FromDiscord<jmgomez> Again, you either have an intermediate type created by the library for you or you have to specify it at compile time
18:35:44*Notxor joined #nim
18:36:31*rockcavera quit (Remote host closed the connection)
18:39:21FromDiscord<Dudugz> Easier to look for a MySQL-oriented library.
18:39:39FromDiscord<jmgomez> And you will face the same issue
18:39:53FromDiscord<Dudugz> nope, because db_mysql work out of box
18:40:24FromDiscord<jmgomez> then for the third and last time, it creates an intermediate type for you
18:40:30FromDiscord<Dudugz> I mean, what you want me to do doesn't exist, and I've tried using rdb.create but obviously it's a procedure for creating a table, which didn't work because I already have an existing table with data.
18:40:45FromDiscord<Dudugz> In reply to @Dudugz "i tried to pass": i made one tho
18:41:41FromDiscord<Dudugz> my issue is that it's trying to parse "name" as float, but it's text in the db https://media.discordapp.net/attachments/371759389889003532/1108464371530739793/image.png
18:41:43FromDiscord<jmgomez> Again, I used the library once last year and it worked as expected for what I wanted to test. If you feel like what you are doing is right, just open an issue the developer is active
18:56:55FromDiscord<jmgomez> Did you try to run that in a fresh db for the sake of debugging? I looked briefly at the code an where it fails seems like the returned type from the driver is wrong
18:57:58FromDiscord<Dudugz> No, that's because as I said I already have a database ready for testing, I was just switching from db_mysql to an asynchronous version.
18:58:11FromDiscord<Dudugz> and yes, in db_mysql i didn't have any issue with my db
18:59:07FromDiscord<Dudugz> The strangest part of allographer is because it gives the option to choose the MySQL driver and forcefully use MariaDB
18:59:27FromDiscord<Dudugz> Every operation with mysql.Xproc has been replaced in the library code by mariadb.Xproc
19:00:20FromDiscord<Dudugz> I mean, the two are similar but not the same, I even had to install the mariadb driver even though I chose mysql.
19:00:39*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:01:22FromDiscord<jmgomez> In reply to @Dudugz "No, that's because as": so start there if you want to use it
19:01:54FromDiscord<Dudugz> i did, nothing changed, like i said, it should be using mysql driver, not maria one
19:02:01FromDiscord<Dudugz> type ids may be diff
19:02:27FromDiscord<Dudugz> new db with nothing inside, same error, players table created by code https://media.discordapp.net/attachments/371759389889003532/1108469598782754898/image.png
19:03:55FromDiscord<jmgomez> create the inserts from Nim. Debug rule number one, go towards the minimal repro with as much fixed moving pieces as possible
19:05:16FromDiscord<jmgomez> btw if you dont care about allowgrapher you could just borrow the async parts that are useful to you and call it a day
19:10:32FromDiscord<Dudugz> very interesting that you drop mysql, you seemed to lean towards PostgreSQL, it seems well implemented, MySQL doesn't. https://media.discordapp.net/attachments/371759389889003532/1108471633804537897/image.png
19:10:42*rockcavera joined #nim
19:10:44FromDiscord<Dudugz> (edit) "you drop" => "it discards"
19:13:01FromDiscord<Chronos [She/Her]> Would code like `await unpackVarargs(listener, args)` work?
19:13:19FromDiscord<Chronos [She/Her]> It looks like it will, but wanna check
19:19:23*lucasta joined #nim
19:22:51*progranner joined #nim
19:22:51*rockcavera quit (Remote host closed the connection)
19:23:16*progranner quit (Client Quit)
19:25:58FromDiscord<Chronos [She/Her]> `/home/horizon/.choosenim/toolchains/nim-1.6.12/lib/pure/asyncmacro.nim(126, 11) Error: await expects Future[T], got void` not sure how the hell this is happening
19:30:12FromDiscord<Chronos [She/Her]> https://paste.ecorous.org/raw/wuwepuhusa this is my code
19:30:25FromDiscord<Chronos [She/Her]> Seems to be line 69 that's the issue?
19:30:58FromDiscord<Chronos [She/Her]> https://paste.ecorous.org/raw/kuxihaceki this is the test code
19:33:13*progranner joined #nim
19:36:47*progranner quit (Client Quit)
19:37:28*progranner joined #nim
19:37:33FromDiscord<Chronos [She/Her]> This is pain
19:40:09*progranner quit (Client Quit)
19:41:07*lucasta quit (Quit: Leaving)
19:41:52*progranner joined #nim
19:46:35FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4w4D
19:48:22FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4w4E
19:48:29FromDiscord<Chronos [She/Her]> Changing it to what it wants literally makes zero sense
20:21:14NimEventerNew Nimble package! chat_openai - A CLI for the Chat series of models provided by OpenAI, see https://github.com/joshuajohncohen/chat_openai-nim
20:36:14FromDiscord<@theperfectcomputer-628303036da0> sent a code paste, see https://paste.rs/2odV3
20:37:33*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:38:57*progranner joined #nim
20:41:11FromDiscord<auxym> In reply to @@theperfectcomputer-628303036da0 "I want to export": pretty sure you have to use asterisks. `export` is used to export symbols you have `import`ed from external modules
20:41:48FromDiscord<@theperfectcomputer-628303036da0> well, `export MovedFile` works
20:41:58FromDiscord<@theperfectcomputer-628303036da0> but yeah, not `export fromPath`
20:43:38FromDiscord<Elegantbeef> You have to export fields specifically
20:44:09FromDiscord<@theperfectcomputer-628303036da0> so you can't export fields using the `export` keyword?
20:44:57FromDiscord<Elegantbeef> You can only use `export` on top level symbols
20:45:02FromDiscord<Elegantbeef> A field is not a top level symbol
20:45:09FromDiscord<@theperfectcomputer-628303036da0> ok - I'm not fond of that
20:45:47FromDiscord<Elegantbeef> Well it is what it is and it's better than having fields exported randomly inside a module
20:45:59FromDiscord<Elegantbeef> You can always write a property and use `export` like a heathen if you really dislike it
20:47:02FromDiscord<@theperfectcomputer-628303036da0> Well, my issue with the astericks is it always trips me up - I keep thinking C pointer
20:47:03FromDiscord<@theperfectcomputer-628303036da0> and this is clearly not that
20:47:03FromDiscord<Elegantbeef> Well this is not C, so stop it get some help 😛
20:48:49FromDiscord<@theperfectcomputer-628303036da0> Haskell's syntax is really nice for this IMO\:https://github.com/BracketMaster/learn-clash/blob/main/src/RS232/State.hs#L1
20:50:10FromDiscord<@theperfectcomputer-628303036da0> I used to think Haskell was jibberish - but the more I used it - the more i fell in love
20:50:10FromDiscord<Elegantbeef> We should really be up in arms about C using `` for pointer, when the superior `^` is more pointy!
20:50:10FromDiscord<@theperfectcomputer-628303036da0> Now it makes total sense!
20:50:11FromDiscord<Elegantbeef> I hear Stockholm is nice this time of the year
20:51:48FromDiscord<Elegantbeef> Hopefully you do not take offence to my jokes 😄
21:01:37*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:03:22*progranner joined #nim
21:11:31FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "We should really be": Why did they use astricks anyway instead of anything else
21:12:01*lucasta joined #nim
21:12:19FromDiscord<Elegantbeef> Does C really seem like a language that has it's syntax designed well
21:17:37FromDiscord<Chronos [She/Her]> Nope lol
21:17:52FromDiscord<Chronos [She/Her]> People say C is a protocol rather than a language now because of how people use it
21:18:52*rockcavera joined #nim
21:25:30FromDiscord<demotomohiro> C was designed long time ago. Maybe there are some reason in its design that young people don't know.
21:26:07FromDiscord<Elegantbeef> Pascal was also designed a long time ago and does not have as many worts
21:26:07FromDiscord<Elegantbeef> 😛
21:26:13FromDiscord<Elegantbeef> It uses `^` for pointer!
21:26:37FromDiscord<Elegantbeef> warts even
21:27:42FromDiscord<0ffh> In reply to @Elegantbeef "It uses `^` for": The different pointer syntax was what took me longest to get used to when switching from (Turbo) Pascal to C. Everything else was super easy as the languages are so similar in many respects.
21:28:04FromDiscord<Elegantbeef> I assume also the fact that C doesnt have a construct of an array was a bit annoying
21:28:17FromDiscord<Elegantbeef> C just has pointers, all pointers arr arrays and all arrays are pointers
21:28:41FromDiscord<Elegantbeef> Yes yes static arrays exist, but they're closer to pointers than other languages do it
21:29:02FromDiscord<0ffh> Yeah, it's different but curiously it didn't bother me very much at all.
21:29:39FromDiscord<0ffh> Though I was a bit surprised when I learned that a[b] == b[a]
21:30:42FromDiscord<0ffh> Apart from that I just think of a[b] = (a+b) so that bridges the pointer and array world.
21:31:20FromDiscord<0ffh> Funnily that also explains the curious first fact, when you think a bit.
21:33:36FromDiscord<JJ> so with unqualified enums now as the default: how can i tell nim to qualify them?
21:34:40FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4w4V
21:37:09FromDiscord<inv> Any ideas who freed ...0050 ptr here? https://media.discordapp.net/attachments/371759389889003532/1108508530576736377/image.png
21:41:02FromDiscord<Elegantbeef> For good reason you cannot↵(@JJ)
21:42:11FromDiscord<Elegantbeef> put it inside a `main` proc inv
21:42:23FromDiscord<Elegantbeef> Move semantics is hard to follow at top level cause it doesnt work there
21:42:59FromDiscord<inv> does it mean it leaks? Or its ok because it knows prog terminates?
21:43:15FromDiscord<Elegantbeef> It will not leak if you properly manage the memory
21:43:44FromDiscord<inv> yep, from main it looks ok.
21:43:58FromDiscord<inv> Can you please explain what is going without main ?
21:44:15FromDiscord<inv> I mean - not in details, but what happened there?
21:44:36FromDiscord<Elegantbeef> A copy is made at line 10 I assume
21:44:42FromDiscord<Elegantbeef> Then freed
21:45:15FromDiscord<inv> but where is destructor for it ? why in main only?
21:45:30FromDiscord<inv> Is it possible that it is some gcc optimization?
21:47:19FromDiscord<inv> So, without main it is freed without calling destructor - how
21:47:42FromDiscord<demotomohiro> Variables outside of procs exists as long as process alive.↵Variables inside proc are freed when exit the proc.
21:47:45FromDiscord<Elegantbeef> It's destructed at the end of the program
21:49:21FromDiscord<inv> Sorry, did not get. the last line of the screenshot calls the destructor, but data = nil there
21:50:01FromDiscord<Elegantbeef> So it doesnt dealloc
21:50:17FromDiscord<inv> during echo - it was ok, then the first "d" it is already nil
21:50:43FromDiscord<Elegantbeef> Testing this outside a proc is a fools errand imo
21:51:25FromDiscord<JJ> wait, i think i'm loosing it and completely misremembered enum semantics
21:51:33FromDiscord<Elegantbeef> Lol
21:51:36FromDiscord<inv> Yep, I agree, just wanted to understand how the free happened
21:52:03FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4w4Y
21:52:13FromDiscord<Elegantbeef> Are you on `#devel`?
21:52:17FromDiscord<Elegantbeef> Are you using `overloadableEnum`
21:52:43FromDiscord<JJ> looks like 1.6.12
21:52:51FromDiscord<Elegantbeef> Arc/Orc use scope based destruction so at the end of scope the destructor is called. Uncertain the problem, to focused on my GUI 😄↵(@inv)
21:53:02FromDiscord<Elegantbeef> With 1.6.12 you need to use the experimental flag
21:53:14FromDiscord<inv> it is refc at the moment
21:53:28FromDiscord<Elegantbeef> Well there's your first problem
21:53:37FromDiscord<Elegantbeef> Refc doesnt abide by destructors as you expect
21:53:39FromDiscord<Elegantbeef> So stop using refc
21:53:59FromDiscord<inv> ok, I thought it will call it anyway
21:54:07FromDiscord<JJ> nice, yeah, that was it
21:54:22FromDiscord<inv> with --mm:arc I see exatctly the same picture
21:54:38FromDiscord<Elegantbeef> Give the code
21:54:56FromDiscord<JJ> i guess it's been a while since i actually had to use overloadable enums or something, i thought that was stabilized
21:55:06FromDiscord<Elegantbeef> It's default in devel
21:55:21FromDiscord<inv> @ElegantBeef code from me or JJ ?
21:55:28FromDiscord<Elegantbeef> You
21:55:53*greaser|q quit (Changing host)
21:55:53*greaser|q joined #nim
21:55:57*greaser|q is now known as GreaseMonkey
21:56:49FromDiscord<inv> sent a long message, see http://ix.io/4w50
21:56:52FromDiscord<inv> oh, long link
21:57:05FromDiscord<Elegantbeef> Also in a VM runtime 😄
21:58:36FromDiscord<inv> https://gist.github.com/inv2004/208eb994d2a05ca890dac582e44a071f
21:59:21FromDiscord<JJ> oh cool, didn't know others were hosting nim playgrounds
21:59:25FromDiscord<inv> did not know playground is restored
21:59:41FromDiscord<Elegantbeef> Jaes that isnt another playground
21:59:44FromDiscord<Elegantbeef> james\
21:59:48FromDiscord<Elegantbeef> That's a VM based playground
21:59:50FromDiscord<Elegantbeef> It runs locally
21:59:58FromDiscord<inv> https://play.nim-lang.org/#ix=4w51
22:00:01FromDiscord<Elegantbeef> It's faaaast
22:00:09FromDiscord<JJ> wait, that's sick
22:00:24FromDiscord<JJ> nimscript?
22:00:39FromDiscord<Elegantbeef> Inv you're deallocating the pointer to x
22:00:58FromDiscord<Elegantbeef> That's what you want
22:00:59FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/7Kk6U
22:01:04FromDiscord<Elegantbeef> Nimscripter no less↵(@JJ)
22:01:25*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
22:02:12FromDiscord<inv> last 3 lines:↵ptr 0x55ddb3c1c5e0 --> [data = ptr 0x7f3002b94050 --> [...]]↵d ptr 0x55ddb3c1c5e8 --> [data = ptr 0x7f3002b941d0 --> [...]]↵d ptr 0x55ddb3c1c5e0 --> [data = nil]
22:02:49FromDiscord<inv> yep, the last one tries to deallocate it, but it has nil already
22:03:07FromDiscord<JJ> wait, what is this beef
22:03:16FromDiscord<JJ> i thought nimscript was the vm-compatible subset of nim
22:03:16FromDiscord<Elegantbeef> What is what?
22:03:27FromDiscord<JJ> your nimscripter
22:03:30FromDiscord<inv> sent a long message, see http://ix.io/4w52
22:03:30FromDiscord<Elegantbeef> Nimscript is the vm subset of Nim
22:03:39FromDiscord<Elegantbeef> Nimscripter takes it an makes it easy to embed
22:03:40FromDiscord<inv> there is only one d for 0x55ddb3c1c5e0
22:04:21FromDiscord<Elegantbeef> https://github.com/gabbhack/nimplay/blob/master/src/nimscript.nim quite respectable 😛
22:04:29FromDiscord<inv> (edit) "http://ix.io/4w52" => "http://ix.io/4w53"
22:04:45FromDiscord<Elegantbeef> Stop using refc for move semantics
22:04:48FromDiscord<Elegantbeef> Like really stop it
22:05:13FromDiscord<inv> But with --mm:arc I see the same (if not in main)
22:05:38FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4w54
22:05:42FromDiscord<Elegantbeef> Run that with arc
22:05:55FromDiscord<inv> Cannot sleep until I understans who stole my pointer before my destructor
22:06:09FromDiscord<Elegantbeef> Refc probably did
22:06:12FromDiscord<Elegantbeef> It works fine with arc
22:09:59FromDiscord<inv> You are right. Thank you
22:10:19FromDiscord<inv> Now cannot sleep witout undertanding why refc stole it 🙂
22:10:33FromDiscord<inv> because I thought refc is just refs without magic
22:10:50FromDiscord<inv> it should call destructor anyway I thought
22:11:04FromDiscord<Elegantbeef> I mean refc is broken with destructors imo
22:11:10FromDiscord<Elegantbeef> It's awful and do not expect them to work there
22:11:17FromDiscord<inv> ok, thx
22:11:39FromDiscord<inv> it calls destructor, but somehow ptr is stolen or freed already
22:11:52FromDiscord<inv> (edit) "it calls destructor, but somehow ptr is stolen or freed already ... " added "with refc"
22:12:42*Notxor quit (Quit: Leaving)
22:12:46FromDiscord<Elegantbeef> refc probably zeros after destructors and has an odd ordering for how they're used since it doesnt do scope based destructing
22:13:06FromDiscord<inv> hah, it fails with -d:debug, release is ok
22:13:37FromDiscord<inv> (edit) "hah, it fails with -d:debug, ... release" added "but"
22:15:00FromDiscord<inv> Thank you. Can go to the next =sink from now 🙂
22:15:39*progranner joined #nim
22:44:24*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
23:48:34*jmdaemon joined #nim