<< 03-07-2023 >>

01:09:47*flouer quit (Ping timeout: 250 seconds)
01:16:46*flouer joined #nim
01:20:12*thomasross quit (Ping timeout: 245 seconds)
01:36:54FromDiscord<gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1125238707704828004/image.png
01:37:10FromDiscord<gogolxdong666> What's the different between move and direct assignment?
01:37:33FromDiscord<gogolxdong666> (edit) "different" => "difference"
01:38:42FromDiscord<Elegantbeef> `move` forces a move
01:38:53FromDiscord<Elegantbeef> direct assignment may not always move
01:39:14FromDiscord<gogolxdong666> What does move essentially mean?
01:39:23FromDiscord<Elegantbeef> Give up resources you own
01:40:19FromDiscord<gogolxdong666> means save memory compared with assignment?
01:41:08FromDiscord<gogolxdong666> like the literal meaning of `move`
01:41:18FromDiscord<Elegantbeef> If the object has references yes, it's apart of move semantics
02:26:57FromDiscord<Prestige> When creating an object and adding it to a seq, is there a way to manage the same object without accidentally doing a copy?↵Same with retrieving the object from the seq and changing its properties
02:33:18FromDiscord<michaelb.eth> @Prestige you want `ref` I think
02:34:03FromDiscord<demotomohiro> In reply to @avahe "When creating an object": You can disable copy: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-can-i-use-object-types-for-seq-even-if-copying-is-disabledqmark
02:34:05FromDiscord<Prestige> using ptr worked but I think I should be avoiding that in Nim
02:34:08FromDiscord<Prestige> oh neat
02:35:16FromDiscord<Elegantbeef> Worth noting you cannot disable copy just for specific scopes
02:46:31FromDiscord<gogolxdong666> What's the way of statically link dll on windows
02:46:32FromDiscord<Prestige> aha, found the byaddr pragma
02:47:05FromDiscord<gogolxdong666> (edit) "statically" => "static"
02:51:23*tomasoatnight joined #nim
02:51:34*tomasoatnight quit (Client Quit)
02:59:58FromDiscord<Elegantbeef> @gogolxdong666 you don't link DLLs that's what makes the D in DLL
03:00:01FromDiscord<Elegantbeef> static link\
03:00:41FromDiscord<gogolxdong666> could not load: (libcrypto-1_1-x64|libeay64).dll
03:01:01FromDiscord<Elegantbeef> You need to statically link openssl on windows which is a bit of work
03:01:12FromDiscord<Elegantbeef> Alternatively you could use chronos which uses bearssl
03:05:23*antranigv quit (Ping timeout: 264 seconds)
03:05:38FromDiscord<gogolxdong666> Is bearssl staically linked?
03:05:47FromDiscord<gogolxdong666> (edit) "staically" => "statically"
03:05:51FromDiscord<Elegantbeef> Yes
03:06:18FromDiscord<gogolxdong666> ok, will try, thanks!
05:05:46FromDiscord<gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1125291269011288154/image.png
05:08:58*azimut quit (Ping timeout: 240 seconds)
05:12:19*azimut joined #nim
05:13:36FromDiscord<_gumbercules> huh... just found a new blog post that the submitter of that HN thread re: the forums had posted previously: https://ramanlabs.in/static/blog/raw_memory_management_patterns_in_nim_language.html - did not know this existed
05:17:52FromDiscord<Elegantbeef> Pretty good post
05:47:28FromDiscord<gamedroit> In reply to @Elegantbeef "You need to statically": or just add your bin folder to path, so the program can find it, is not that hard.
05:48:10FromDiscord<Elegantbeef> Statically link
05:48:30FromDiscord<gamedroit> (edit) "hard." => "hard.↵https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/"
05:49:11FromDiscord<gamedroit> In reply to @Elegantbeef "Statically link": sorry, for me statically link would be passing a argument to the compiler so it can find the dll, like -L"path to lib"
05:49:31FromDiscord<gamedroit> (edit) "a" => "an"
05:49:32FromDiscord<Elegantbeef> No statically linking compiles the library into your code based off what you use
06:02:47FromDiscord<_gumbercules> For further clarity - symbols are loaded from DLLs and other forms of shared libraries at runtime. When a library is linked statically, the linker will resolve the symbols and include them in the executable when it links the object file(s) the compiler output.
06:03:54FromDiscord<_gumbercules> This is why static linking increases the size of binaries and is also why you need to have DLLs in your linker's search path / system path / next to your executable
06:05:35FromDiscord<demotomohiro> In reply to @gamedroit "sorry, for me statically": There are 2 type of .lib files. One type is statically linked library and contains library code and doesn't load dll.↵Another type is used like static library when linking but doesn't contains library implementation and loads dynamic library at runtime.
06:12:25FromDiscord<Hamid_Bluri> In reply to @takemichihanagaki3129 "Impressive! What is this": I've just published it, it was just an experiment↵↵https://github.com/hamidb80/ncss
06:21:27*ntat joined #nim
06:30:46FromDiscord<JeysonFlores> So.... The _lent_ modifier in a return type is like _var_ in the sense that both are references to the original object but the variable returned as _lent_ cannot be modified
06:30:58FromDiscord<JeysonFlores> (edit) "modified" => "modified?"
06:34:28FromDiscord<takemichihanagaki3129> In reply to @hamidb80 "I've just published it,": Having a look on it right now! Very good job!
06:35:14FromDiscord<Elegantbeef> @JeysonFlores yes
06:37:29*PMunch joined #nim
06:45:06FromDiscord<JeysonFlores> so... Whenever I want to catch that _lent_ed return value into an identifier, do I have to use _let_?
06:45:14FromDiscord<JeysonFlores> (edit) "_lent_ed" => "_lent_ ed"
06:45:23FromDiscord<JeysonFlores> (edit) "ed" => "'ed"
06:45:57FromDiscord<Elegantbeef> Nope it copies cause Nim doesnt have a borrow checker
06:48:14FromDiscord<JeysonFlores> So, If it copies then what's the difference between that and just returning by value?
06:48:31FromDiscord<Elegantbeef> Assigning to a variable copies
06:48:39FromDiscord<Elegantbeef> `someProc(myThing).doThing()` doesnt
06:49:16FromDiscord<Elegantbeef> assuming `someProc` returns `lent T`
06:50:02FromDiscord<Elegantbeef> It's the same rules as `var T` if you assign a variable to it, it copies
06:51:40FromDiscord<JeysonFlores> And in order for doThing to work it has to be doThing(x: T) or doThing(x: var T)?
06:51:49FromDiscord<JeysonFlores> (edit) "And in order for doThing to work ... it" added "in that example"
06:52:04FromDiscord<Elegantbeef> if `someProc` returns `lent` `doThing` has to be `x: T`
06:53:03FromDiscord<Elegantbeef> The point is that it doesnt copy if consumed directly
06:55:41FromDiscord<JeysonFlores> So... This is useful particularly when changing right? It allows to perform several (read)operations over an object without copying and being sure it won't be modified for those procs
06:55:52FromDiscord<JeysonFlores> (edit) "changing" => "chaining"
06:56:05FromDiscord<Elegantbeef> Yes
06:56:15FromDiscord<JeysonFlores> Nice, thanks
07:12:26FromDiscord<jeremyjaydan> just finished reading the manual 🎉 took me a week and a half (skipped some stuff like C++ & asm)
07:12:34FromDiscord<jeremyjaydan> don't quiz me tho
07:13:26*ovenpasta joined #nim
07:13:53FromDiscord<jeremyjaydan> next I shall read the std
07:16:31FromDiscord<odexine> In reply to @jeremyjaydan "don't quiz me tho": “Ok what does the pure pragma do for objects”
07:17:25FromDiscord<jeremyjaydan> uh
07:17:30FromDiscord<jeremyjaydan> shit
07:17:40FromDiscord<jeremyjaydan> makes it pure?
07:17:56PMunchHard to fault you on that one :P
07:18:24PMunchAre you just reading through the manual without coding anything?
07:20:01FromDiscord<jeremyjaydan> nah I've been playing with nim while reading along
07:20:11FromDiscord<jeremyjaydan> trying really hard to not move on unless I really get it
07:20:50FromDiscord<jeremyjaydan> some stuff I didn't learn too much about like the ast for macros as the basic concept is ast in -> ast out
07:21:16PMunchYeah the AST macro stuff is its own beast
07:21:26PMunchBest get comfortable with the basics first
07:22:14FromDiscord<jeremyjaydan> Yea I'm thinking as long as the syntax / theory is down for the most part I'll be good
07:22:38FromDiscord<jeremyjaydan> Not entirely confident with ref yet but that'll take time & use cases to grasp I think
07:23:23FromDiscord<demotomohiro> In reply to @jeremyjaydan "uh": Here is the answer: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-how-pure-pragma-dotpuredot-work-to-object-typeqmark
07:23:54FromDiscord<jeremyjaydan> what docs are these? 😮
07:24:24FromDiscord<jeremyjaydan> interesting thanks!
07:26:42PMunchWith ref vs. ptr, or just reference semantics in general?
07:27:09FromDiscord<demotomohiro> In reply to @jeremyjaydan "what docs are these?": It is just a my blog.
07:28:07FromDiscord<jeremyjaydan> In reply to @PMunch "With ref vs. ptr,": I get the general concept that it's a reference to a single thing in memory, I think what trips me up is that, that behaviour is basically default in javascript with objects
07:29:47FromDiscord<jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDn
07:29:54FromDiscord<demotomohiro> sent a long message, see https://paste.rs/9IW7O
07:30:25FromDiscord<jeremyjaydan> In reply to @jeremyjaydan "and the syntax around": the `[]`, it makes me think of accessing an index in an array
07:31:32FromDiscord<jeremyjaydan> (edit) "https://play.nim-lang.org/#ix=4zDn" => "https://play.nim-lang.org/#ix=4zDo"
07:31:36PMunchWhich is kinda the point
07:31:40FromDiscord<jeremyjaydan> also the `new` keyword, I think I need to re-read how that works
07:31:46PMunch[] accesses the data at that address
07:32:20PMunchThink about memory as a wall of mailboxes in an apartment building
07:33:08FromDiscord<jeremyjaydan> doesn't it dereference it? I'm also confused my that, because if it's 'dereferenced', why does the assignment work?
07:33:36PMunchPassing a normal non-ref object to someone would be the same as passing them a piece of mail directly. But passing a ref object would be analogous to giving them the number of the mailbox the piece of mail was in
07:33:48FromDiscord<Elegantbeef> dereferencing creates a L-value
07:33:51FromDiscord<Elegantbeef> Those can be assigned to
07:33:55PMunchThe [] operator simply means "go open this mailbox"
07:34:28FromDiscord<jeremyjaydan> ah ok, so it more-so "opens" the reference?
07:34:39PMunchPretty much
07:34:51FromDiscord<jeremyjaydan> that makes more sense
07:35:34PMunchYeah so `myRefObj[].x = 100` would be "open the mailbox myRefObj and change the piece of mail named x so that it says 100"
07:35:37PMunchOr something like that
07:36:09FromDiscord<jeremyjaydan> yea that makes sense
07:37:03PMunchNow comes the interesting part. If I had handed you a letter and you changed it, then I would be none the wiser. I gave you a piece of mail which said 100 on it, and I don't know what you've done to it. But if I gave you a mailbox number and you went to that mailbox and changed a letter, I would be able to open the same mailbox and see that the value has changed.
07:37:11PMunchThis is what's called "reference semantics"
07:37:45PMunchWe both have the mailbox number, so if we change what's in the mailbox we can both see the change.
07:38:14PMunchUnlike if I've copied a letter and handed you one of the copies, then I won't see that you have made changes to it
07:38:30FromDiscord<jeremyjaydan> is there any point that would break that reference? I suppose break isn't the right term but maybe "overlay" it?
07:38:51PMunchIn a language without a garbage collector, then yes
07:39:12PMunchThis is where alloc/free and new comes in
07:39:37FromDiscord<jeremyjaydan> ok so I shouldn't be worried about a reference "stop working"
07:39:40PMunchIn C for example, which doesn't have a garbage collector, you need to use alloc and free to create and destroy mailboxes
07:39:44FromDiscord<jeremyjaydan> unless I'm doing manual memory management
07:40:16PMunchAlloc puts up a new mailbox and gives you back the number of that mailbox, and free tears down the mailbox with the given number.
07:41:28FromDiscord<jeremyjaydan> I'd like to learn more about memory management
07:41:32PMunchSo if I have set up a mailbox, then put some mail in it and give you the number of the mailbox, only to immediately take the mailbox down it won't do you any good. You would either get an error, or you would just read what happens to be in the spot the mailbox was in.
07:42:20PMunchBut with a garbage collector we don't call free. When you call `new` you set up a new mailbox, but then it's up to the janitor to figure out if a mailbox is in use or not
07:42:23*m5zs7k quit (Ping timeout: 250 seconds)
07:42:58PMunchSo as long as someone uses a mailbox he won't take it down. But if no-one is using it then the mailbox is taken down, and a new one can go up in its place (freeing memory)
07:43:15*m5zs7k joined #nim
07:43:41FromDiscord<jeremyjaydan> can you call new multiple times on a reference? does new effectively instantiate a reference?
07:43:43PMunchOf course the "no one uses it" heuristic is a bit different for mailboxes and memory
07:44:05FromDiscord<Elegantbeef> new allocates memory and returns a pointer back to it
07:44:16FromDiscord<Elegantbeef> Personally I prefer thinking of memory as a big old array of bytes
07:44:18PMunchNo you call `new` on a type, not an existing reference
07:44:42FromDiscord<Elegantbeef> You can do `new result` 😄
07:44:48PMunchWhen you call `new` on a type the janitor will put up a mailbox big enough to fit that type
07:45:27FromDiscord<jeremyjaydan> is it similar to javascript class instantiation?
07:45:39PMunchTrue Elegantbeef, but that's basically just a syntactic shortcut for `result = new typeof(result).pointerBase` or something like that
07:46:01PMunchjeremyjaydan, kinda, but not exactly
07:47:28FromDiscord<jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDq
07:47:48FromDiscord<Elegantbeef> Yea it's basically the same as a class
07:47:53PMunchAll new does is to put up a mailbox the size of the type you give it. Say you call `new` on a letter type the janitor could set up a small mailbox, but if you called `new` on a package from a furniture store the janitor would need to but up a much bigger mailbox.
07:47:54FromDiscord<jeremyjaydan> I suppose the type is already tied to an (l-value?), then calling new on it creates the mailbox?
07:48:26FromDiscord<Elegantbeef> `myInt` is really an index into your big array of data
07:48:42FromDiscord<Elegantbeef> so when you do `new myInt` it gives you memory
07:48:51FromDiscord<Elegantbeef> this can be see with `echo cast[int](myInt)`
07:50:07FromDiscord<jeremyjaydan> so myint is "soon to be a location" and `new myint` writes that location?
07:50:35PMunchYou can think of `new myInt` as `myInt = new(typeof(myInt).pointerBase)` where `typeof` returns the kind of mailbox and pointerBase returns what's supposed to go in the mailbox.
07:51:11PMunch`myInt` is really just the number of a mailbox, initially it is 0, which means no mailbox yet assigned
07:51:53PMunchWhen you call `new myInt` you tell the janitor to put up a mailbox the size of what you want to store and puts the number of that mailbox in `myInt`.
07:52:12PMunchNow `myInt[]` can open the mailbox and put stuff in it or read stuff from it
07:52:41FromDiscord<jeremyjaydan> sent a code paste, see https://paste.rs/p2wVr
07:52:45PMunchIf you hadn't called `new myInt` you would try to open mailbox 0, and that makes the janitor very angry (null dereference)
07:53:17PMunchYou would then tell the janitor to put up a mailbox, and before you do anything with it you would tell him to put up another
07:53:40PMunchSince you never gave the number of the first mailbox to anyone the janitor knows that this mailbox is not used, so he can take it down again
07:53:41*ovenpasta quit (Ping timeout: 246 seconds)
07:54:12FromDiscord<jeremyjaydan> ooooh
07:54:14PMunchWhen you pass the number of the mailbox to someone they must go write their name on the mailbox
07:54:41FromDiscord<jeremyjaydan> is it recommended to only use `new` once on a reference?
07:54:49FromDiscord<jeremyjaydan> (or type rather?)
07:55:04PMunchWell it depends on what you need to do
07:55:13PMunchYou already have your mailbox, do you need another?
07:55:47PMunchIf you had passed the mailbox over to someone else, so that they have written their name on it, before you call `new myInt` again the janitor wouldn't take it down.
07:56:09FromDiscord<jeremyjaydan> I feel like it would be confusing readability wise to keep track of which mailbox is which with a "single" variable that has multiple mailboxes
07:56:32PMunchWell a single variable can't have more than one mailbox
07:56:58FromDiscord<jeremyjaydan> oh
07:56:59*ovenpasta joined #nim
07:57:28FromDiscord<jeremyjaydan> In reply to @jeremyjaydan "what if you did:": with this, if you called new twice, how would the mailboxes be assigned?
07:58:33FromDiscord<jeremyjaydan> I was thinking if you did `new myint` then passed it to something, that something opens it with `myint[]`, it now has access to that mailbox, then if you did `new myint` again, then passed it to something2, and that did `myint[]`, then that would have access to another mailbox
07:58:55FromDiscord<jeremyjaydan> so I assumed mailboxes are based on time
07:59:59FromDiscord<jeremyjaydan> I might need to do some coding with it over time to really get the nuance aha
08:00:09PMunchWell first you call `new myInt`, this makes the janitor put up a new mailbox and puts the number of that mailbox into the `myInt` variable and writes your name on the mailbox. Now you call `new myInt` again the janitor would put up a new mailbox and put the number of that mailbox in your `myInt` variable. But since you no longer have kept the original mailbox number anywhere you strike you name of the first mailbox. The janitor now sees that this mailbox
08:00:09PMunchdoesn't have a name on it and takes it off the wall.
08:01:10FromDiscord<jeremyjaydan> > But since you no longer have kept the original mailbox number anywhere↵what if I did tho?
08:01:19FromDiscord<jeremyjaydan> is that possible?
08:18:38PMunchSure, you just assign it to another variable
08:18:46PMunch`myOtherInt = myInt`
08:19:14PMunchNow `myOtherInt` has the number of the mailbox, so if you call `new myInt` you will have two mailboxes, one in each variable
08:19:15*ovenpasta quit (Read error: Connection reset by peer)
08:20:10PMunchWhen you assign it to another variable you write that name on the mailbox as well, so when you call `new myInt` again and erase your name the janitor can still see that there is another name on it and won't take it down
08:20:12*ovenpasta joined #nim
08:20:24PMunchThe janitor in this analogy is the garbage collector by the way
08:20:47PMunchWithout the janitor you would have to manually put up and take down mailboxes with alloc and free
08:21:18*azimut quit (Ping timeout: 240 seconds)
08:21:29PMunchAnd you would have to keep track of if anyone has a reference to a mailbox yourself
08:26:19*ovenpasta quit (Ping timeout: 246 seconds)
08:37:02FromDiscord<jeremyjaydan> I think I understand, though I'm still a bit confused by the new keyword but I'm finding it hard to put into words
08:40:49FromDiscord<jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDD
08:43:00PMunchYes that's more of a language thing
08:43:25PMunchBy default everything in Nim is initialized to 0, so myInt holds mailbox number 0 (which as you remember means no mailbox)
08:43:39FromDiscord<demotomohiro> ref is basically a pointer. And Nim initialize all variables with zero fill.↵So initial value of ref are nil.
08:43:55FromDiscord<jeremyjaydan> oooh ok that makes sense
08:44:23FromDiscord<jeremyjaydan> I expected the ref to be the initialisation by default but yeah nah that makes sense
08:44:38FromDiscord<_gumbercules> `var myInt: MyInt` isn't initializing anything though it's simply a declaratin
08:44:50FromDiscord<_gumbercules> this is standard in pretty much every PL - declaration doesn't == initialization
08:45:04FromDiscord<_gumbercules> if Nim allocatd memory whenever you declared a variable, that would be a bad thing
08:45:05FromDiscord<jeremyjaydan> so it initialises at instantiation?
08:45:08PMunch(Although in Nim it is initialized to 0)
08:45:21FromDiscord<_gumbercules> `nil` for `ref`
08:45:42PMunchSome programming languages doesn't initialize at all, so accessing something before initialization would be undefined behaviour
08:45:59FromDiscord<_gumbercules> (edit) "declaratin" => "declaration"
08:46:01*Guest99 joined #nim
08:46:18FromDiscord<_gumbercules> (edit) "allocatd" => "allocated heap"
08:46:25FromDiscord<jeremyjaydan> ok, thanks everyone for your insight!
08:46:29*Guest99 quit (Client Quit)
08:46:44FromDiscord<jeremyjaydan> time to learn http I think
08:48:06FromDiscord<jeremyjaydan> and how to uninstall javascript
08:49:47FromDiscord<odexine> You mean node?
08:50:32FromDiscord<demotomohiro> I guess uninstall javascript == uninstall web browser.
08:52:46Amun-Raor install noscript or something similar
08:54:42FromDiscord<jeremyjaydan> I was joking :p
09:05:40*ntat quit (Quit: Leaving)
10:45:57FromDiscord<ambient3332> sent a code paste, see https://paste.rs/muJs5
10:46:19FromDiscord<odexine> "can't use ptr with ORC"? what's the issue?
10:46:22FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=
10:46:46FromDiscord<odexine> and what is pcmf32
10:46:47FromDiscord<ambient3332> Nim 1.6.14, --mm:orc
10:47:10FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=
10:47:35FromDiscord<odexine> you're doing it wrong, it should be `cast[ptr cfloat](pcmf32[0].addr)`
10:48:37FromDiscord<ambient3332> That works, now I just have to understand why
10:48:48FromDiscord<odexine> `cast[ptr cfloat](pcmf32)` makes the value of the sequence into a pointer (makes no sense)↵`cast[ptr cfloat](pcmf32.addr)` could be correct but sequences have extra data at the start
10:49:07FromDiscord<odexine> so you have to get the pointer to the first element of the sequence `pcmf32[0].addr`
10:49:10FromDiscord<ambient3332> sequences are not just C arrays in memory?
10:49:13FromDiscord<odexine> no they are not
10:49:24FromDiscord<odexine> sequences store length and capacity information
10:49:26FromDiscord<odexine> (edit) "sequences store length and capacity information ... " added "as well"
10:49:51FromDiscord<demotomohiro> Then, changing length of `pcmf32` can be UB if that C function refers that pointer after return.
10:49:53FromDiscord<odexine> how it is stored depends on the gc iirc but the nitty gritty isnt exactly important if this is all you need to know, i'd say
10:50:23FromDiscord<odexine> In reply to @demotomohiro "Then, changing length of": yeah be sure that the library doesnt hold this pointer outside the function call
10:50:55FromDiscord<odexine> if it does, then there's extra work needed (by adding gc ref/unref calls in the correct places, which might be tricky)
10:50:59FromDiscord<demotomohiro> seq is actually like a object type with pointer + length field.
10:52:19FromDiscord<odexine> iirc seq is roughly (not real nim code ofc, shorthand-ish) `(len: int, ptr (cap: int, data: pointer))` (no i dont know the exact integral type they use)
10:54:36FromDiscord<demotomohiro> This is seq implementation:↵https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim
10:54:52FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=
10:57:42FromDiscord<odexine> thats why look at what tomohiro sent
10:57:50FromDiscord<odexine> thats the "real" impl
10:58:34*ovenpasta joined #nim
11:01:10FromDiscord<ambient3332> Thanks for the help
11:02:07FromDiscord<System64 ~ Flandre Scarlet> In reply to @spotlightkid "I should have said\:": I understood why I have this error↵No problem with C backend, but those errors only occurs with C++ backend↵Why?
11:03:46FromDiscord<System64 ~ Flandre Scarlet> C++ should be compatible with C code
11:05:52FromDiscord<demotomohiro> Latest version of C++ might not compatible with latest version of C.
11:06:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Latest version of C++": Is it possible to select the C++ and C standards?
11:07:13FromDiscord<odexine> https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
11:07:18FromDiscord<demotomohiro> In reply to @sys64 "Is it possible to": gcc has -std=cxx option to select standard
11:07:20FromDiscord<odexine> "C is not a subset of C++"
11:07:40FromDiscord<odexine> though, this is somewhat irrelevant to the issue
11:08:04FromDiscord<odexine> the issue is more of that the C++ backend has a bug of some sort instead of "C++ compilers should be able to compile C code"
11:08:46FromDiscord<System64 ~ Flandre Scarlet> https://github.com/m13253/nim-kissfft↵I try to use this
11:09:04FromDiscord<demotomohiro> In reply to @sys64 "Is it possible to": https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Dialect-Options.html#index-std-1
11:13:42FromDiscord<odexine> In reply to @sys64 "https://github.com/m13253/nim-kissfft I try to": wrapper might not be compatible with cpp
11:14:27FromDiscord<System64 ~ Flandre Scarlet> Ah so I need to find another library
11:15:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "wrapper might not be": I can use C, but I have a segfault with ImGUI then
11:16:08FromDiscord<System64 ~ Flandre Scarlet> and it requires a cimgui DLL
11:17:17FromDiscord<odexine> i'd go with that then
11:17:26FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "i'd go with that": you mean C backend?
11:17:31FromDiscord<odexine> yes
11:17:42FromDiscord<System64 ~ Flandre Scarlet> problem is this segfault
11:22:01FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEl
11:22:02Amun-Raand the segfault → incorrect abi
11:22:30FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "and the segfault →": wdym?
11:22:50Amun-Rathere's null pointer somewhere
11:23:12FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEm
11:23:16FromDiscord<System64 ~ Flandre Scarlet> And no problem with C++
11:23:45FromDiscord<System64 ~ Flandre Scarlet> can the DLL be faulty?
11:24:36Amun-Raecho cast[pointer](igOpenGL3NewFrame).repr
11:24:52FromDiscord<System64 ~ Flandre Scarlet> what's going on?
11:25:59Amun-Rais it 0 when using C backend?
11:26:08FromDiscord<System64 ~ Flandre Scarlet> ah, lemme check
11:26:29FromDiscord<System64 ~ Flandre Scarlet> I must do thaat with the function?
11:26:57Amun-Rano
11:27:48FromDiscord<System64 ~ Flandre Scarlet> I have that : 00007FF7EAF8A2C0
11:28:11Amun-Rahmm
11:28:32Amun-Raah, what about igOpenGL3CreateFontsTexture?
11:30:23FromDiscord<System64 ~ Flandre Scarlet> Compiler Error : Undeclared identifier
11:31:08Amun-Rathat was the last function before the sigsegv, hmm
11:31:34Amun-Rawell, the culprit maybe the following one
11:32:37*ovenpasta quit (Read error: Connection reset by peer)
11:33:00*ovenpasta joined #nim
11:35:16FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "that was the last": Still not 0↵00007FF6A1566AB0
11:42:25FromDiscord<jmgomez> In reply to @odexine "the issue is more": please @System64 ~ Flandre Scarlet if this is the case, do a minimal repro and submit an issue
11:44:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @jmgomez "please <@380360389377916939> if this": To the GitHub?
11:45:40FromDiscord<planetis_m> How does one deal with this, when compiling with -d:windows on linux? https://media.discordapp.net/attachments/371759389889003532/1125391907569274920/d0014c4675bd4b39.png
11:46:10FromDiscord<jmgomez> In reply to @sys64 "To the GitHub?": yes, https://github.com/nim-lang/Nim/issues
11:46:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @jmgomez "yes, https://github.com/nim-lang/Nim/issues": Alright↵Is it a Nim problem or a wrapper problem?
11:47:36FromDiscord<jmgomez> In reply to @sys64 "Alright Is it a": I dont know what the issue is, Im saying it based on what Rika wrote above
11:48:25FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵I try to update first to see if it solves the problem
11:48:58*PMunch_ joined #nim
11:49:37*ntat joined #nim
11:50:23FromDiscord<demotomohiro> In reply to @planetis_m "How does one deal": Im making a library that can handle path correctly when you do cross compiling: https://github.com/demotomohiro/pathX
11:51:46*PMunch quit (Ping timeout: 246 seconds)
11:52:16FromDiscord<planetis_m> nice
11:54:18FromDiscord<demotomohiro> In reply to @planetis_m "How does one deal": I dont know what raylib.nim do, but I guess it make a path to c file using os module and procedures in os module normalize the path and replace all path separaters to '\'.
11:54:47FromDiscord<planetis_m> yes exactly
11:57:21FromDiscord<demotomohiro> In reply to @planetis_m "How does one deal": Related issue:↵https://github.com/nim-lang/Nim/issues/21534↵https://github.com/nim-lang/Nim/issues/19558
11:58:25FromDiscord<planetis_m> Thanks for the links, you're very helpful
11:59:13NimEventerNew thread by r3c: Realloc and self referencing array problem, see https://forum.nim-lang.org/t/10316
12:04:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @jmgomez "yes, https://github.com/nim-lang/Nim/issues": https://github.com/nim-lang/Nim/issues/22214↵I filled an issue ticket
12:06:00FromDiscord<jmgomez> A minimal repro doesnt include `kissfft` though
12:06:12FromDiscord<jmgomez> it may be an issue with that package
12:06:55FromDiscord<jmgomez> The issue would be fine for the package itself, but not for the compiler
12:07:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @jmgomez "The issue would be": Ah, it's related to this package so
12:08:19FromDiscord<System64 ~ Flandre Scarlet> Now, the library isn't updated since a long time
12:10:27FromDiscord<System64 ~ Flandre Scarlet> https://github.com/SciNim/impulse↵This thing has FFT
12:19:23FromDiscord<System64 ~ Flandre Scarlet> Wait, does Nim standard library have a FFT?
12:22:34*ovenpasta quit (Ping timeout: 260 seconds)
12:23:08*ovenpasta joined #nim
12:31:52FromDiscord<auxym> don't think, I think your best bet is the fftw3 bindings: https://github.com/SciNim/nimfftw3
12:34:11FromDiscord<ambient3332> I wrote a simple FFT and SFTF for Mel spectrograms https://github.com/amb/nim_audiobook/blob/main/fft.nim it's surprisingly fast, but also very WIP. If anyone wuold like to improve in it, they would be very welcome
12:34:56*PMunch_ is now known as PMunch
12:35:04FromDiscord<ambient3332> not sure if using Arraymancer is wise. Seems in my tests it was slightly slower than just using seqs
12:35:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "don't think, I think": Problem is this library is under GPL I think
12:38:48FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEC
12:38:56FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zED
12:40:39FromDiscord<System64 ~ Flandre Scarlet> Like↵I can't create a seq of Complex numbers?
12:49:52*ovenpasta quit (Ping timeout: 240 seconds)
13:04:47FromDiscord<k0ts> is that std/complex? Complex is generic
13:06:29FromDiscord<System64 ~ Flandre Scarlet> In reply to @k0ts "is that std/complex? Complex": Ah alright, so I need to replace it with Complex64 or Complex32?
13:07:05FromDiscord<k0ts> probably
13:09:58FromDiscord<System64 ~ Flandre Scarlet> And Pow doesn't support complex numbers? https://media.discordapp.net/attachments/371759389889003532/1125413122329542706/image.png
13:11:29FromDiscord<odexine> `[2] func pow[T](x, y: Complex[T]): Complex[T]`
13:11:44FromDiscord<odexine> `(T, T) != Complex[T]`
13:11:51FromDiscord<System64 ~ Flandre Scarlet> Oh alright
13:12:42*ovenpasta joined #nim
13:33:09FromDiscord<vindaar> In reply to @ambient3332 "not sure if using": unless you do something funny, arraymancer should be at least as fast as a seq. If you effectively only use arraymancer `Tensors` as a flat data store than it should give you the same performance as a `seq`. If you do some operations on the tensor / seq, it might be faster. The only use cases where arraymancer tensors are slower, is if you need to resize a lot and thus could benefit from the
13:33:16*ovenpasta quit (Ping timeout: 246 seconds)
14:01:29NimEventerNew thread by xTrayambak: Ferus -- a tiny web engine written in Nim, see https://forum.nim-lang.org/t/10317
14:42:47FromDiscord<Clonkk> FFTW3 is GPL. because the bindings are only linked with the original library, the bindings themselves are LGPL↵(@System64 ~ Flandre Scarlet)
14:43:29FromDiscord<Clonkk> Anything more permissive than LGPL is impossible if it uses FFTW3
14:54:00FromDiscord<michaelb.eth> In reply to @Clonkk "Anything more permissive than": it depends on what you distribute, right?
14:56:04FromDiscord<Clonkk> As far as, I understand license, anything that uses GPL must be GPL. There is an exception if you link GPL code without modifying it then you can be LGPL.
15:03:41FromDiscord<System64 ~ Flandre Scarlet> In reply to @Clonkk "FFTW3 is GPL. because": But then, my entire code base will be LGPL/GPL no?
15:05:49*eron joined #nim
15:06:37FromDiscord<michaelb.eth> In reply to @Clonkk "As far as, I": I don't think that's quite right
15:07:09FromDiscord<michaelb.eth> if you link against GPL lib, modified or not, your code needs to be GPL
15:07:34FromDiscord<System64 ~ Flandre Scarlet> So I can't use it because I want to avoid to be GPL
15:07:35FromDiscord<michaelb.eth> nim-fftw3's using the LGPL license just confuses the matter, I think
15:08:31*eron quit (Client Quit)
15:13:09FromDiscord<Clonkk> [I'm not a lawyer, but from what I've read, derivative work can be released under GPL compatible license.](https://en.wikipedia.org/wiki/GPL_linking_exception)↵(@michaelb.eth)
15:13:47*MightyJoe quit (Ping timeout: 264 seconds)
15:13:53*cyraxjoe joined #nim
15:13:57FromDiscord<odexine> In reply to @Clonkk "[I'm not a lawyer,": only if the license includes that exception
15:13:59FromDiscord<odexine> which fftw does not
15:16:49FromDiscord<michaelb.eth> https://www.gnu.org/licenses/gpl-faq.html#GPLStaticVsDynamic
15:17:04FromDiscord<michaelb.eth> ^ the answer is different for LGPL
15:17:16FromDiscord<michaelb.eth> which is addressed in the next FAQ entry
15:18:29FromDiscord<odexine> btw, nim import doesnt count as static linking
15:18:35FromDiscord<odexine> at least to my knowledge it does not
15:19:27FromDiscord<michaelb.eth> IANAL, but seems to me nim-fftw3 (because it's just source code) could have been under whatever license they wanted (MIT, LGPL, EPL, whatever), but it doesn't really matter because the point of it is so you can build a Nim program that links to the fftw3 library, which is GPL
15:22:27FromDiscord<Clonkk> Ah so bindings wouldn't be covered as source code using the original then ?↵(@michaelb.eth)
15:22:29FromDiscord<voidwalker> I see there were talks about strutils using `openArray[char]`. Will we have that in nim 2.0 ?
15:22:37FromDiscord<Clonkk> Honestly this feel like a grey area
15:23:33FromDiscord<michaelb.eth> In reply to @Clonkk "Ah so bindings wouldn't": not sure I understand the question
15:25:31FromDiscord<System64 ~ Flandre Scarlet> Wouldn't writting my own Fourier Transform be safer?
15:35:01FromDiscord<spotlightkid> Re the original of finding a suitable FFT lib\: https://community.vcvrack.com/t/complete-list-of-c-c-fft-libraries/9153
15:56:16*junaid_ joined #nim
16:05:01*junaid_ quit (Remote host closed the connection)
16:25:26*ovenpasta joined #nim
17:38:15NimEventerNew thread by mantielero: Reading a PNG at compile time, see https://forum.nim-lang.org/t/10318
17:44:17FromDiscord<mratsim> In reply to @sys64 "Wouldn't writting my own": https://github.com/SciNim/impulse/blob/master/impulse/fft/pocketfft.nim#L300-L339
17:56:44*cyraxjoe quit (Quit: I'm out!)
17:58:40*cyraxjoe joined #nim
18:03:47*eron joined #nim
18:06:59*eron left #nim (#nim)
18:15:48*azimut joined #nim
18:35:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @mratsim "https://github.com/SciNim/impulse/blob/master/impul": Why does it need an UnsafeAddr?
18:38:03Amun-Ranim <2.0 requires unsafeaddr for non-var variables
18:38:24*junaid_ joined #nim
18:39:10*junaid_ quit (Client Quit)
18:39:25FromDiscord<System64 ~ Flandre Scarlet> Oh alright
18:39:35FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "nim <2.0 requires unsafeaddr": But I use Nim 2.0
18:39:57Amun-Rait seems the module supports 1.x
18:40:00*junaid_ joined #nim
18:46:33*rockcavera joined #nim
18:54:41*rockcavera quit (Remote host closed the connection)
20:19:25*PMunch_ joined #nim
20:21:59*PMunch quit (Ping timeout: 246 seconds)
20:33:25NimEventerNew thread by xwlt: Can I create a thread with gc-UNsafe procedure?, see https://forum.nim-lang.org/t/10319
21:00:10*junaid_ quit (Remote host closed the connection)
21:11:32*antranigv joined #nim
22:12:42*Arthur quit (Ping timeout: 245 seconds)
22:15:59*ovenpasta quit (Ping timeout: 250 seconds)
22:18:11*Arthur joined #nim
22:32:16*ntat quit (Quit: Leaving)
22:38:48*Mister_Magister quit (Server closed connection)
22:39:16*Mister_Magister joined #nim
23:26:22FromDiscord<voidwalker> if I have `if (a and b and c)`, will a get evaluted first, then b, and if a is determined false, will the evaluation of b and c not happen ?
23:26:38FromDiscord<voidwalker> (edit) "a get" => "`a`get" | "b," => "`b`," | "a" => "`a`"
23:28:12FromDiscord<Elegantbeef> Yes it short circuits
23:28:36FromDiscord<voidwalker> that's great, cause I can one line it then
23:32:56FromDiscord<voidwalker> also, I saw you talking about `openarray[char]` in strutils, needed to use it on `array[char]` today and had to rewrite it in my module. What is the news on that ?
23:33:09FromDiscord<Elegantbeef> use devel
23:34:36FromDiscord<Elegantbeef> Oh wait strutils
23:34:39FromDiscord<Elegantbeef> Ah nah araq said no
23:35:12FromDiscord<voidwalker> and we're just gonna let it go then ?
23:35:14FromDiscord<Elegantbeef> Someone could(should) copy strutils to their own module and convert it to openArray
23:35:19FromDiscord<Elegantbeef> But I just havent been motivated to do such
23:35:45FromDiscord<Elegantbeef> `unicode` and `parseutils` are more primitive operations that needed to support it to reduce work in other modules
23:40:30FromDiscord<Elegantbeef> Be the change you want to see and author your own `openarraycharutils` or even cooler `openarraybyteutils` 😄
23:43:23FromDiscord<voidwalker> the whole point of std is to not have to write it yourself again
23:43:39FromDiscord<Elegantbeef> Don't argue with me
23:43:59FromDiscord<Elegantbeef> Patito made the PR it was rejected, so what can I do about it 😄
23:44:09FromDiscord<voidwalker> we should have a mutiny
23:44:23FromDiscord<huantian> what, fork the language?
23:44:32FromDiscord<huantian> that always works out haha
23:44:32FromDiscord<voidwalker> oh yeah we should go to nimskull camp
23:46:06FromDiscord<voidwalker> their strutils is not changed much
23:46:18*oz quit (Server closed connection)
23:46:32*ox joined #nim
23:46:42FromDiscord<Elegantbeef> Almost like they're not concerned with the stdlib cause they are working purely on compiler development
23:48:33FromDiscord<voidwalker> Is all that rewriting really necessary ?
23:49:08FromDiscord<Elegantbeef> What rewriting ?
23:49:17FromDiscord<voidwalker> that they're trying to do to the compiler
23:49:27FromDiscord<voidwalker> cause "it's bad"
23:49:41FromDiscord<Elegantbeef> It's to add new features and to make the compiler better
23:49:44FromDiscord<Elegantbeef> So likely it is
23:52:40FromDiscord<Elegantbeef> Most of their plans are to enable a more usable language and better compiler development experience
23:53:13FromDiscord<voidwalker> If more one liner opportunities, I'll go for it
23:53:57FromDiscord<Elegantbeef> oh fuck off
23:54:12FromDiscord<Elegantbeef> That was a joke if unclear
23:54:22FromDiscord<voidwalker> mine too : P
23:54:40FromDiscord<Elegantbeef> Go write a language that uses curlies and semicolons so you can have the ultimate one liner
23:54:57FromDiscord<Elegantbeef> "This program is written in a single line, because if the code is only a single line it cannot be complex"
23:58:19FromDiscord<voidwalker> but I never wrote with curlies, I only did pascal before nim, not sure I can get into that.
23:59:19FromDiscord<voidwalker> when I see code perfectly indented like it would be nim-compatible, in rust for example, and all those curlies.. I wonder where are curlies actually useful
23:59:51FromDiscord<Elegantbeef> I'm told it helps readability if you do not have indention lines