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:54 | FromDiscord | <gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1125238707704828004/image.png |
01:37:10 | FromDiscord | <gogolxdong666> What's the different between move and direct assignment? |
01:37:33 | FromDiscord | <gogolxdong666> (edit) "different" => "difference" |
01:38:42 | FromDiscord | <Elegantbeef> `move` forces a move |
01:38:53 | FromDiscord | <Elegantbeef> direct assignment may not always move |
01:39:14 | FromDiscord | <gogolxdong666> What does move essentially mean? |
01:39:23 | FromDiscord | <Elegantbeef> Give up resources you own |
01:40:19 | FromDiscord | <gogolxdong666> means save memory compared with assignment? |
01:41:08 | FromDiscord | <gogolxdong666> like the literal meaning of `move` |
01:41:18 | FromDiscord | <Elegantbeef> If the object has references yes, it's apart of move semantics |
02:26:57 | FromDiscord | <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:18 | FromDiscord | <michaelb.eth> @Prestige you want `ref` I think |
02:34:03 | FromDiscord | <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:05 | FromDiscord | <Prestige> using ptr worked but I think I should be avoiding that in Nim |
02:34:08 | FromDiscord | <Prestige> oh neat |
02:35:16 | FromDiscord | <Elegantbeef> Worth noting you cannot disable copy just for specific scopes |
02:46:31 | FromDiscord | <gogolxdong666> What's the way of statically link dll on windows |
02:46:32 | FromDiscord | <Prestige> aha, found the byaddr pragma |
02:47:05 | FromDiscord | <gogolxdong666> (edit) "statically" => "static" |
02:51:23 | * | tomasoatnight joined #nim |
02:51:34 | * | tomasoatnight quit (Client Quit) |
02:59:58 | FromDiscord | <Elegantbeef> @gogolxdong666 you don't link DLLs that's what makes the D in DLL |
03:00:01 | FromDiscord | <Elegantbeef> static link\ |
03:00:41 | FromDiscord | <gogolxdong666> could not load: (libcrypto-1_1-x64|libeay64).dll |
03:01:01 | FromDiscord | <Elegantbeef> You need to statically link openssl on windows which is a bit of work |
03:01:12 | FromDiscord | <Elegantbeef> Alternatively you could use chronos which uses bearssl |
03:05:23 | * | antranigv quit (Ping timeout: 264 seconds) |
03:05:38 | FromDiscord | <gogolxdong666> Is bearssl staically linked? |
03:05:47 | FromDiscord | <gogolxdong666> (edit) "staically" => "statically" |
03:05:51 | FromDiscord | <Elegantbeef> Yes |
03:06:18 | FromDiscord | <gogolxdong666> ok, will try, thanks! |
05:05:46 | FromDiscord | <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:36 | FromDiscord | <_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:52 | FromDiscord | <Elegantbeef> Pretty good post |
05:47:28 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> Statically link |
05:48:30 | FromDiscord | <gamedroit> (edit) "hard." => "hard.↵https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/" |
05:49:11 | FromDiscord | <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:31 | FromDiscord | <gamedroit> (edit) "a" => "an" |
05:49:32 | FromDiscord | <Elegantbeef> No statically linking compiles the library into your code based off what you use |
06:02:47 | FromDiscord | <_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:54 | FromDiscord | <_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:35 | FromDiscord | <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:25 | FromDiscord | <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:46 | FromDiscord | <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:58 | FromDiscord | <JeysonFlores> (edit) "modified" => "modified?" |
06:34:28 | FromDiscord | <takemichihanagaki3129> In reply to @hamidb80 "I've just published it,": Having a look on it right now! Very good job! |
06:35:14 | FromDiscord | <Elegantbeef> @JeysonFlores yes |
06:37:29 | * | PMunch joined #nim |
06:45:06 | FromDiscord | <JeysonFlores> so... Whenever I want to catch that _lent_ed return value into an identifier, do I have to use _let_? |
06:45:14 | FromDiscord | <JeysonFlores> (edit) "_lent_ed" => "_lent_ ed" |
06:45:23 | FromDiscord | <JeysonFlores> (edit) "ed" => "'ed" |
06:45:57 | FromDiscord | <Elegantbeef> Nope it copies cause Nim doesnt have a borrow checker |
06:48:14 | FromDiscord | <JeysonFlores> So, If it copies then what's the difference between that and just returning by value? |
06:48:31 | FromDiscord | <Elegantbeef> Assigning to a variable copies |
06:48:39 | FromDiscord | <Elegantbeef> `someProc(myThing).doThing()` doesnt |
06:49:16 | FromDiscord | <Elegantbeef> assuming `someProc` returns `lent T` |
06:50:02 | FromDiscord | <Elegantbeef> It's the same rules as `var T` if you assign a variable to it, it copies |
06:51:40 | FromDiscord | <JeysonFlores> And in order for doThing to work it has to be doThing(x: T) or doThing(x: var T)? |
06:51:49 | FromDiscord | <JeysonFlores> (edit) "And in order for doThing to work ... it" added "in that example" |
06:52:04 | FromDiscord | <Elegantbeef> if `someProc` returns `lent` `doThing` has to be `x: T` |
06:53:03 | FromDiscord | <Elegantbeef> The point is that it doesnt copy if consumed directly |
06:55:41 | FromDiscord | <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:52 | FromDiscord | <JeysonFlores> (edit) "changing" => "chaining" |
06:56:05 | FromDiscord | <Elegantbeef> Yes |
06:56:15 | FromDiscord | <JeysonFlores> Nice, thanks |
07:12:26 | FromDiscord | <jeremyjaydan> just finished reading the manual 🎉 took me a week and a half (skipped some stuff like C++ & asm) |
07:12:34 | FromDiscord | <jeremyjaydan> don't quiz me tho |
07:13:26 | * | ovenpasta joined #nim |
07:13:53 | FromDiscord | <jeremyjaydan> next I shall read the std |
07:16:31 | FromDiscord | <odexine> In reply to @jeremyjaydan "don't quiz me tho": “Ok what does the pure pragma do for objects” |
07:17:25 | FromDiscord | <jeremyjaydan> uh |
07:17:30 | FromDiscord | <jeremyjaydan> shit |
07:17:40 | FromDiscord | <jeremyjaydan> makes it pure? |
07:17:56 | PMunch | Hard to fault you on that one :P |
07:18:24 | PMunch | Are you just reading through the manual without coding anything? |
07:20:01 | FromDiscord | <jeremyjaydan> nah I've been playing with nim while reading along |
07:20:11 | FromDiscord | <jeremyjaydan> trying really hard to not move on unless I really get it |
07:20:50 | FromDiscord | <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:16 | PMunch | Yeah the AST macro stuff is its own beast |
07:21:26 | PMunch | Best get comfortable with the basics first |
07:22:14 | FromDiscord | <jeremyjaydan> Yea I'm thinking as long as the syntax / theory is down for the most part I'll be good |
07:22:38 | FromDiscord | <jeremyjaydan> Not entirely confident with ref yet but that'll take time & use cases to grasp I think |
07:23:23 | FromDiscord | <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:54 | FromDiscord | <jeremyjaydan> what docs are these? 😮 |
07:24:24 | FromDiscord | <jeremyjaydan> interesting thanks! |
07:26:42 | PMunch | With ref vs. ptr, or just reference semantics in general? |
07:27:09 | FromDiscord | <demotomohiro> In reply to @jeremyjaydan "what docs are these?": It is just a my blog. |
07:28:07 | FromDiscord | <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:47 | FromDiscord | <jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDn |
07:29:54 | FromDiscord | <demotomohiro> sent a long message, see https://paste.rs/9IW7O |
07:30:25 | FromDiscord | <jeremyjaydan> In reply to @jeremyjaydan "and the syntax around": the `[]`, it makes me think of accessing an index in an array |
07:31:32 | FromDiscord | <jeremyjaydan> (edit) "https://play.nim-lang.org/#ix=4zDn" => "https://play.nim-lang.org/#ix=4zDo" |
07:31:36 | PMunch | Which is kinda the point |
07:31:40 | FromDiscord | <jeremyjaydan> also the `new` keyword, I think I need to re-read how that works |
07:31:46 | PMunch | [] accesses the data at that address |
07:32:20 | PMunch | Think about memory as a wall of mailboxes in an apartment building |
07:33:08 | FromDiscord | <jeremyjaydan> doesn't it dereference it? I'm also confused my that, because if it's 'dereferenced', why does the assignment work? |
07:33:36 | PMunch | Passing 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:48 | FromDiscord | <Elegantbeef> dereferencing creates a L-value |
07:33:51 | FromDiscord | <Elegantbeef> Those can be assigned to |
07:33:55 | PMunch | The [] operator simply means "go open this mailbox" |
07:34:28 | FromDiscord | <jeremyjaydan> ah ok, so it more-so "opens" the reference? |
07:34:39 | PMunch | Pretty much |
07:34:51 | FromDiscord | <jeremyjaydan> that makes more sense |
07:35:34 | PMunch | Yeah 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:37 | PMunch | Or something like that |
07:36:09 | FromDiscord | <jeremyjaydan> yea that makes sense |
07:37:03 | PMunch | Now 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:11 | PMunch | This is what's called "reference semantics" |
07:37:45 | PMunch | We both have the mailbox number, so if we change what's in the mailbox we can both see the change. |
07:38:14 | PMunch | Unlike 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:30 | FromDiscord | <jeremyjaydan> is there any point that would break that reference? I suppose break isn't the right term but maybe "overlay" it? |
07:38:51 | PMunch | In a language without a garbage collector, then yes |
07:39:12 | PMunch | This is where alloc/free and new comes in |
07:39:37 | FromDiscord | <jeremyjaydan> ok so I shouldn't be worried about a reference "stop working" |
07:39:40 | PMunch | In C for example, which doesn't have a garbage collector, you need to use alloc and free to create and destroy mailboxes |
07:39:44 | FromDiscord | <jeremyjaydan> unless I'm doing manual memory management |
07:40:16 | PMunch | Alloc 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:28 | FromDiscord | <jeremyjaydan> I'd like to learn more about memory management |
07:41:32 | PMunch | So 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:20 | PMunch | But 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:58 | PMunch | So 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:41 | FromDiscord | <jeremyjaydan> can you call new multiple times on a reference? does new effectively instantiate a reference? |
07:43:43 | PMunch | Of course the "no one uses it" heuristic is a bit different for mailboxes and memory |
07:44:05 | FromDiscord | <Elegantbeef> new allocates memory and returns a pointer back to it |
07:44:16 | FromDiscord | <Elegantbeef> Personally I prefer thinking of memory as a big old array of bytes |
07:44:18 | PMunch | No you call `new` on a type, not an existing reference |
07:44:42 | FromDiscord | <Elegantbeef> You can do `new result` 😄 |
07:44:48 | PMunch | When you call `new` on a type the janitor will put up a mailbox big enough to fit that type |
07:45:27 | FromDiscord | <jeremyjaydan> is it similar to javascript class instantiation? |
07:45:39 | PMunch | True Elegantbeef, but that's basically just a syntactic shortcut for `result = new typeof(result).pointerBase` or something like that |
07:46:01 | PMunch | jeremyjaydan, kinda, but not exactly |
07:47:28 | FromDiscord | <jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDq |
07:47:48 | FromDiscord | <Elegantbeef> Yea it's basically the same as a class |
07:47:53 | PMunch | All 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:54 | FromDiscord | <jeremyjaydan> I suppose the type is already tied to an (l-value?), then calling new on it creates the mailbox? |
07:48:26 | FromDiscord | <Elegantbeef> `myInt` is really an index into your big array of data |
07:48:42 | FromDiscord | <Elegantbeef> so when you do `new myInt` it gives you memory |
07:48:51 | FromDiscord | <Elegantbeef> this can be see with `echo cast[int](myInt)` |
07:50:07 | FromDiscord | <jeremyjaydan> so myint is "soon to be a location" and `new myint` writes that location? |
07:50:35 | PMunch | You 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:11 | PMunch | `myInt` is really just the number of a mailbox, initially it is 0, which means no mailbox yet assigned |
07:51:53 | PMunch | When 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:12 | PMunch | Now `myInt[]` can open the mailbox and put stuff in it or read stuff from it |
07:52:41 | FromDiscord | <jeremyjaydan> sent a code paste, see https://paste.rs/p2wVr |
07:52:45 | PMunch | If you hadn't called `new myInt` you would try to open mailbox 0, and that makes the janitor very angry (null dereference) |
07:53:17 | PMunch | You 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:40 | PMunch | Since 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:12 | FromDiscord | <jeremyjaydan> ooooh |
07:54:14 | PMunch | When you pass the number of the mailbox to someone they must go write their name on the mailbox |
07:54:41 | FromDiscord | <jeremyjaydan> is it recommended to only use `new` once on a reference? |
07:54:49 | FromDiscord | <jeremyjaydan> (or type rather?) |
07:55:04 | PMunch | Well it depends on what you need to do |
07:55:13 | PMunch | You already have your mailbox, do you need another? |
07:55:47 | PMunch | If 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:09 | FromDiscord | <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:32 | PMunch | Well a single variable can't have more than one mailbox |
07:56:58 | FromDiscord | <jeremyjaydan> oh |
07:56:59 | * | ovenpasta joined #nim |
07:57:28 | FromDiscord | <jeremyjaydan> In reply to @jeremyjaydan "what if you did:": with this, if you called new twice, how would the mailboxes be assigned? |
07:58:33 | FromDiscord | <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:55 | FromDiscord | <jeremyjaydan> so I assumed mailboxes are based on time |
07:59:59 | FromDiscord | <jeremyjaydan> I might need to do some coding with it over time to really get the nuance aha |
08:00:09 | PMunch | Well 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:09 | PMunch | doesn't have a name on it and takes it off the wall. |
08:01:10 | FromDiscord | <jeremyjaydan> > But since you no longer have kept the original mailbox number anywhere↵what if I did tho? |
08:01:19 | FromDiscord | <jeremyjaydan> is that possible? |
08:18:38 | PMunch | Sure, you just assign it to another variable |
08:18:46 | PMunch | `myOtherInt = myInt` |
08:19:14 | PMunch | Now `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:10 | PMunch | When 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:24 | PMunch | The janitor in this analogy is the garbage collector by the way |
08:20:47 | PMunch | Without 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:29 | PMunch | And 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:02 | FromDiscord | <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:49 | FromDiscord | <jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zDD |
08:43:00 | PMunch | Yes that's more of a language thing |
08:43:25 | PMunch | By default everything in Nim is initialized to 0, so myInt holds mailbox number 0 (which as you remember means no mailbox) |
08:43:39 | FromDiscord | <demotomohiro> ref is basically a pointer. And Nim initialize all variables with zero fill.↵So initial value of ref are nil. |
08:43:55 | FromDiscord | <jeremyjaydan> oooh ok that makes sense |
08:44:23 | FromDiscord | <jeremyjaydan> I expected the ref to be the initialisation by default but yeah nah that makes sense |
08:44:38 | FromDiscord | <_gumbercules> `var myInt: MyInt` isn't initializing anything though it's simply a declaratin |
08:44:50 | FromDiscord | <_gumbercules> this is standard in pretty much every PL - declaration doesn't == initialization |
08:45:04 | FromDiscord | <_gumbercules> if Nim allocatd memory whenever you declared a variable, that would be a bad thing |
08:45:05 | FromDiscord | <jeremyjaydan> so it initialises at instantiation? |
08:45:08 | PMunch | (Although in Nim it is initialized to 0) |
08:45:21 | FromDiscord | <_gumbercules> `nil` for `ref` |
08:45:42 | PMunch | Some programming languages doesn't initialize at all, so accessing something before initialization would be undefined behaviour |
08:45:59 | FromDiscord | <_gumbercules> (edit) "declaratin" => "declaration" |
08:46:01 | * | Guest99 joined #nim |
08:46:18 | FromDiscord | <_gumbercules> (edit) "allocatd" => "allocated heap" |
08:46:25 | FromDiscord | <jeremyjaydan> ok, thanks everyone for your insight! |
08:46:29 | * | Guest99 quit (Client Quit) |
08:46:44 | FromDiscord | <jeremyjaydan> time to learn http I think |
08:48:06 | FromDiscord | <jeremyjaydan> and how to uninstall javascript |
08:49:47 | FromDiscord | <odexine> You mean node? |
08:50:32 | FromDiscord | <demotomohiro> I guess uninstall javascript == uninstall web browser. |
08:52:46 | Amun-Ra | or install noscript or something similar |
08:54:42 | FromDiscord | <jeremyjaydan> I was joking :p |
09:05:40 | * | ntat quit (Quit: Leaving) |
10:45:57 | FromDiscord | <ambient3332> sent a code paste, see https://paste.rs/muJs5 |
10:46:19 | FromDiscord | <odexine> "can't use ptr with ORC"? what's the issue? |
10:46:22 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix= |
10:46:46 | FromDiscord | <odexine> and what is pcmf32 |
10:46:47 | FromDiscord | <ambient3332> Nim 1.6.14, --mm:orc |
10:47:10 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix= |
10:47:35 | FromDiscord | <odexine> you're doing it wrong, it should be `cast[ptr cfloat](pcmf32[0].addr)` |
10:48:37 | FromDiscord | <ambient3332> That works, now I just have to understand why |
10:48:48 | FromDiscord | <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:07 | FromDiscord | <odexine> so you have to get the pointer to the first element of the sequence `pcmf32[0].addr` |
10:49:10 | FromDiscord | <ambient3332> sequences are not just C arrays in memory? |
10:49:13 | FromDiscord | <odexine> no they are not |
10:49:24 | FromDiscord | <odexine> sequences store length and capacity information |
10:49:26 | FromDiscord | <odexine> (edit) "sequences store length and capacity information ... " added "as well" |
10:49:51 | FromDiscord | <demotomohiro> Then, changing length of `pcmf32` can be UB if that C function refers that pointer after return. |
10:49:53 | FromDiscord | <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:23 | FromDiscord | <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:55 | FromDiscord | <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:59 | FromDiscord | <demotomohiro> seq is actually like a object type with pointer + length field. |
10:52:19 | FromDiscord | <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:36 | FromDiscord | <demotomohiro> This is seq implementation:↵https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim |
10:54:52 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix= |
10:57:42 | FromDiscord | <odexine> thats why look at what tomohiro sent |
10:57:50 | FromDiscord | <odexine> thats the "real" impl |
10:58:34 | * | ovenpasta joined #nim |
11:01:10 | FromDiscord | <ambient3332> Thanks for the help |
11:02:07 | FromDiscord | <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:46 | FromDiscord | <System64 ~ Flandre Scarlet> C++ should be compatible with C code |
11:05:52 | FromDiscord | <demotomohiro> Latest version of C++ might not compatible with latest version of C. |
11:06:15 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "Latest version of C++": Is it possible to select the C++ and C standards? |
11:07:13 | FromDiscord | <odexine> https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B |
11:07:18 | FromDiscord | <demotomohiro> In reply to @sys64 "Is it possible to": gcc has -std=cxx option to select standard |
11:07:20 | FromDiscord | <odexine> "C is not a subset of C++" |
11:07:40 | FromDiscord | <odexine> though, this is somewhat irrelevant to the issue |
11:08:04 | FromDiscord | <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:46 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/m13253/nim-kissfft↵I try to use this |
11:09:04 | FromDiscord | <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:42 | FromDiscord | <odexine> In reply to @sys64 "https://github.com/m13253/nim-kissfft I try to": wrapper might not be compatible with cpp |
11:14:27 | FromDiscord | <System64 ~ Flandre Scarlet> Ah so I need to find another library |
11:15:52 | FromDiscord | <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:08 | FromDiscord | <System64 ~ Flandre Scarlet> and it requires a cimgui DLL |
11:17:17 | FromDiscord | <odexine> i'd go with that then |
11:17:26 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "i'd go with that": you mean C backend? |
11:17:31 | FromDiscord | <odexine> yes |
11:17:42 | FromDiscord | <System64 ~ Flandre Scarlet> problem is this segfault |
11:22:01 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEl |
11:22:02 | Amun-Ra | and the segfault → incorrect abi |
11:22:30 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "and the segfault →": wdym? |
11:22:50 | Amun-Ra | there's null pointer somewhere |
11:23:12 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEm |
11:23:16 | FromDiscord | <System64 ~ Flandre Scarlet> And no problem with C++ |
11:23:45 | FromDiscord | <System64 ~ Flandre Scarlet> can the DLL be faulty? |
11:24:36 | Amun-Ra | echo cast[pointer](igOpenGL3NewFrame).repr |
11:24:52 | FromDiscord | <System64 ~ Flandre Scarlet> what's going on? |
11:25:59 | Amun-Ra | is it 0 when using C backend? |
11:26:08 | FromDiscord | <System64 ~ Flandre Scarlet> ah, lemme check |
11:26:29 | FromDiscord | <System64 ~ Flandre Scarlet> I must do thaat with the function? |
11:26:57 | Amun-Ra | no |
11:27:48 | FromDiscord | <System64 ~ Flandre Scarlet> I have that : 00007FF7EAF8A2C0 |
11:28:11 | Amun-Ra | hmm |
11:28:32 | Amun-Ra | ah, what about igOpenGL3CreateFontsTexture? |
11:30:23 | FromDiscord | <System64 ~ Flandre Scarlet> Compiler Error : Undeclared identifier |
11:31:08 | Amun-Ra | that was the last function before the sigsegv, hmm |
11:31:34 | Amun-Ra | well, 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:16 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "that was the last": Still not 0↵00007FF6A1566AB0 |
11:42:25 | FromDiscord | <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:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jmgomez "please <@380360389377916939> if this": To the GitHub? |
11:45:40 | FromDiscord | <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:10 | FromDiscord | <jmgomez> In reply to @sys64 "To the GitHub?": yes, https://github.com/nim-lang/Nim/issues |
11:46:33 | FromDiscord | <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:36 | FromDiscord | <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:25 | FromDiscord | <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:23 | FromDiscord | <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:16 | FromDiscord | <planetis_m> nice |
11:54:18 | FromDiscord | <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:47 | FromDiscord | <planetis_m> yes exactly |
11:57:21 | FromDiscord | <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:25 | FromDiscord | <planetis_m> Thanks for the links, you're very helpful |
11:59:13 | NimEventer | New thread by r3c: Realloc and self referencing array problem, see https://forum.nim-lang.org/t/10316 |
12:04:13 | FromDiscord | <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:00 | FromDiscord | <jmgomez> A minimal repro doesnt include `kissfft` though |
12:06:12 | FromDiscord | <jmgomez> it may be an issue with that package |
12:06:55 | FromDiscord | <jmgomez> The issue would be fine for the package itself, but not for the compiler |
12:07:39 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jmgomez "The issue would be": Ah, it's related to this package so |
12:08:19 | FromDiscord | <System64 ~ Flandre Scarlet> Now, the library isn't updated since a long time |
12:10:27 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/SciNim/impulse↵This thing has FFT |
12:19:23 | FromDiscord | <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:52 | FromDiscord | <auxym> don't think, I think your best bet is the fftw3 bindings: https://github.com/SciNim/nimfftw3 |
12:34:11 | FromDiscord | <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:04 | FromDiscord | <ambient3332> not sure if using Arraymancer is wise. Seems in my tests it was slightly slower than just using seqs |
12:35:05 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @auxym "don't think, I think": Problem is this library is under GPL I think |
12:38:48 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zEC |
12:38:56 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4zED |
12:40:39 | FromDiscord | <System64 ~ Flandre Scarlet> Like↵I can't create a seq of Complex numbers? |
12:49:52 | * | ovenpasta quit (Ping timeout: 240 seconds) |
13:04:47 | FromDiscord | <k0ts> is that std/complex? Complex is generic |
13:06:29 | FromDiscord | <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:05 | FromDiscord | <k0ts> probably |
13:09:58 | FromDiscord | <System64 ~ Flandre Scarlet> And Pow doesn't support complex numbers? https://media.discordapp.net/attachments/371759389889003532/1125413122329542706/image.png |
13:11:29 | FromDiscord | <odexine> `[2] func pow[T](x, y: Complex[T]): Complex[T]` |
13:11:44 | FromDiscord | <odexine> `(T, T) != Complex[T]` |
13:11:51 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
13:12:42 | * | ovenpasta joined #nim |
13:33:09 | FromDiscord | <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:29 | NimEventer | New thread by xTrayambak: Ferus -- a tiny web engine written in Nim, see https://forum.nim-lang.org/t/10317 |
14:42:47 | FromDiscord | <Clonkk> FFTW3 is GPL. because the bindings are only linked with the original library, the bindings themselves are LGPL↵(@System64 ~ Flandre Scarlet) |
14:43:29 | FromDiscord | <Clonkk> Anything more permissive than LGPL is impossible if it uses FFTW3 |
14:54:00 | FromDiscord | <michaelb.eth> In reply to @Clonkk "Anything more permissive than": it depends on what you distribute, right? |
14:56:04 | FromDiscord | <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:41 | FromDiscord | <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:37 | FromDiscord | <michaelb.eth> In reply to @Clonkk "As far as, I": I don't think that's quite right |
15:07:09 | FromDiscord | <michaelb.eth> if you link against GPL lib, modified or not, your code needs to be GPL |
15:07:34 | FromDiscord | <System64 ~ Flandre Scarlet> So I can't use it because I want to avoid to be GPL |
15:07:35 | FromDiscord | <michaelb.eth> nim-fftw3's using the LGPL license just confuses the matter, I think |
15:08:31 | * | eron quit (Client Quit) |
15:13:09 | FromDiscord | <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:57 | FromDiscord | <odexine> In reply to @Clonkk "[I'm not a lawyer,": only if the license includes that exception |
15:13:59 | FromDiscord | <odexine> which fftw does not |
15:16:49 | FromDiscord | <michaelb.eth> https://www.gnu.org/licenses/gpl-faq.html#GPLStaticVsDynamic |
15:17:04 | FromDiscord | <michaelb.eth> ^ the answer is different for LGPL |
15:17:16 | FromDiscord | <michaelb.eth> which is addressed in the next FAQ entry |
15:18:29 | FromDiscord | <odexine> btw, nim import doesnt count as static linking |
15:18:35 | FromDiscord | <odexine> at least to my knowledge it does not |
15:19:27 | FromDiscord | <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:27 | FromDiscord | <Clonkk> Ah so bindings wouldn't be covered as source code using the original then ?↵(@michaelb.eth) |
15:22:29 | FromDiscord | <voidwalker> I see there were talks about strutils using `openArray[char]`. Will we have that in nim 2.0 ? |
15:22:37 | FromDiscord | <Clonkk> Honestly this feel like a grey area |
15:23:33 | FromDiscord | <michaelb.eth> In reply to @Clonkk "Ah so bindings wouldn't": not sure I understand the question |
15:25:31 | FromDiscord | <System64 ~ Flandre Scarlet> Wouldn't writting my own Fourier Transform be safer? |
15:35:01 | FromDiscord | <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:15 | NimEventer | New thread by mantielero: Reading a PNG at compile time, see https://forum.nim-lang.org/t/10318 |
17:44:17 | FromDiscord | <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:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @mratsim "https://github.com/SciNim/impulse/blob/master/impul": Why does it need an UnsafeAddr? |
18:38:03 | Amun-Ra | nim <2.0 requires unsafeaddr for non-var variables |
18:38:24 | * | junaid_ joined #nim |
18:39:10 | * | junaid_ quit (Client Quit) |
18:39:25 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
18:39:35 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "nim <2.0 requires unsafeaddr": But I use Nim 2.0 |
18:39:57 | Amun-Ra | it 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:25 | NimEventer | New 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:22 | FromDiscord | <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:38 | FromDiscord | <voidwalker> (edit) "a get" => "`a`get" | "b," => "`b`," | "a" => "`a`" |
23:28:12 | FromDiscord | <Elegantbeef> Yes it short circuits |
23:28:36 | FromDiscord | <voidwalker> that's great, cause I can one line it then |
23:32:56 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> use devel |
23:34:36 | FromDiscord | <Elegantbeef> Oh wait strutils |
23:34:39 | FromDiscord | <Elegantbeef> Ah nah araq said no |
23:35:12 | FromDiscord | <voidwalker> and we're just gonna let it go then ? |
23:35:14 | FromDiscord | <Elegantbeef> Someone could(should) copy strutils to their own module and convert it to openArray |
23:35:19 | FromDiscord | <Elegantbeef> But I just havent been motivated to do such |
23:35:45 | FromDiscord | <Elegantbeef> `unicode` and `parseutils` are more primitive operations that needed to support it to reduce work in other modules |
23:40:30 | FromDiscord | <Elegantbeef> Be the change you want to see and author your own `openarraycharutils` or even cooler `openarraybyteutils` 😄 |
23:43:23 | FromDiscord | <voidwalker> the whole point of std is to not have to write it yourself again |
23:43:39 | FromDiscord | <Elegantbeef> Don't argue with me |
23:43:59 | FromDiscord | <Elegantbeef> Patito made the PR it was rejected, so what can I do about it 😄 |
23:44:09 | FromDiscord | <voidwalker> we should have a mutiny |
23:44:23 | FromDiscord | <huantian> what, fork the language? |
23:44:32 | FromDiscord | <huantian> that always works out haha |
23:44:32 | FromDiscord | <voidwalker> oh yeah we should go to nimskull camp |
23:46:06 | FromDiscord | <voidwalker> their strutils is not changed much |
23:46:18 | * | oz quit (Server closed connection) |
23:46:32 | * | ox joined #nim |
23:46:42 | FromDiscord | <Elegantbeef> Almost like they're not concerned with the stdlib cause they are working purely on compiler development |
23:48:33 | FromDiscord | <voidwalker> Is all that rewriting really necessary ? |
23:49:08 | FromDiscord | <Elegantbeef> What rewriting ? |
23:49:17 | FromDiscord | <voidwalker> that they're trying to do to the compiler |
23:49:27 | FromDiscord | <voidwalker> cause "it's bad" |
23:49:41 | FromDiscord | <Elegantbeef> It's to add new features and to make the compiler better |
23:49:44 | FromDiscord | <Elegantbeef> So likely it is |
23:52:40 | FromDiscord | <Elegantbeef> Most of their plans are to enable a more usable language and better compiler development experience |
23:53:13 | FromDiscord | <voidwalker> If more one liner opportunities, I'll go for it |
23:53:57 | FromDiscord | <Elegantbeef> oh fuck off |
23:54:12 | FromDiscord | <Elegantbeef> That was a joke if unclear |
23:54:22 | FromDiscord | <voidwalker> mine too : P |
23:54:40 | FromDiscord | <Elegantbeef> Go write a language that uses curlies and semicolons so you can have the ultimate one liner |
23:54:57 | FromDiscord | <Elegantbeef> "This program is written in a single line, because if the code is only a single line it cannot be complex" |
23:58:19 | FromDiscord | <voidwalker> but I never wrote with curlies, I only did pascal before nim, not sure I can get into that. |
23:59:19 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> I'm told it helps readability if you do not have indention lines |