00:12:28 | * | ltriant quit (Ping timeout: 272 seconds) |
00:39:04 | FromDiscord | <Elegantbeef> Hmph fun and confusing bug that probably is due to typerel |
00:44:23 | FromDiscord | <Yepoleb> Is switching async backends only possible if the library implements support for it? |
00:45:32 | FromDiscord | <Yepoleb> i wanted to use ws with chronos, but apparently Futures are not compatible |
00:46:39 | FromDiscord | <Bung> that need ws support that |
00:47:10 | FromDiscord | <Bung> some libs support by use `asynBackend` compile flag |
00:49:05 | FromDiscord | <Yepoleb> sad, thanks |
00:49:26 | FromDiscord | <Elegantbeef> You could likely use `patchFile` to replace them |
00:50:13 | FromDiscord | <Elegantbeef> Would be nice if the async backends where implemented inside module level |
00:51:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iS4 |
00:51:11 | FromDiscord | <Elegantbeef> were implemented\ |
00:52:48 | FromDiscord | <!&luke> how can i format the json that is outputted from jsony's `toJson` function |
00:54:07 | FromDiscord | <Elegantbeef> Dont think jsony supports prettying |
00:54:26 | FromDiscord | <!&luke> damn |
00:54:51 | FromDiscord | <!&luke> do u know any other json library that can format it |
00:54:54 | FromDiscord | <Elegantbeef> Well it's aimed for speed and users can write their own hooks |
00:54:59 | FromDiscord | <Elegantbeef> std/json |
00:55:10 | FromDiscord | <!&luke> ive heard its slow tho |
00:55:20 | FromDiscord | <Elegantbeef> What you want is slow |
00:55:30 | FromDiscord | <Elegantbeef> Even if it is slow how many Json files are you reading/loading |
00:56:07 | FromDiscord | <!&luke> 1 |
01:16:35 | FromDiscord | <<She>Horizon</Her>> Is speed a concern for your application? If If is, jsony is your best bet |
01:16:46 | FromDiscord | <<She>Horizon</Her>> Well, I'm not sure about best |
01:17:16 | FromDiscord | <<She>Horizon</Her>> But there'd be no reason for prettifying JSON in an environment where speed is top priority, imo |
01:17:41 | FromDiscord | <<She>Horizon</Her>> Otherwise, using `std/json` as beef said is probably a good idea |
01:27:48 | FromDiscord | <Bung> `./koch temp c ../pixie/src/pixie/fileformats/jpeg.nim ` `Error: cannot open file: pixie/common ` how to solve this ? I can't run from nim root directory or the package root directory |
01:28:18 | FromDiscord | <Elegantbeef> `nimble develop` inside the pixie folder i imagine |
01:30:48 | FromDiscord | <Bung> oh, thanks! that works |
01:51:19 | FromDiscord | <!&luke> In reply to @Event Horizon "But there'd be no": It’s user facing json so I just decided to have reads done by jsony and writes preformed by std/json |
01:52:11 | FromDiscord | <<She>Horizon</Her>> Fair enough |
02:17:17 | * | moonlit quit (Remote host closed the connection) |
02:17:34 | * | moonlit joined #nim |
02:21:12 | * | moonlit quit (Remote host closed the connection) |
02:21:35 | * | moonlit joined #nim |
02:28:00 | arkanoid | I'm trying to use threads + locks, but I was facing deadlocks so I went debugging. At the end I made a silly test and I put mylock.acquire and mylock.release as top and last statements of my threaded function (making threads basically useless), but I still got deadlock! (?!?) |
02:30:28 | arkanoid | same effect when nesting the whole body of my threaded function into "withLock mylock: ..." |
02:30:42 | arkanoid | is nim lock mechanism actually tested? |
02:31:08 | FromDiscord | <Yepoleb> what's koch doing there? |
02:33:15 | FromDiscord | <Bung> it's for compiler dev , see full stacktrace |
02:34:06 | FromDiscord | <Elegantbeef> Yes arkanoid |
02:34:13 | FromDiscord | <Elegantbeef> Do you mean to use `tryAcquire`? |
02:34:51 | FromDiscord | <Elegantbeef> `acquire` will attempt to grab the lock and if it fails it spins there |
02:34:59 | FromDiscord | <Elegantbeef> So if both threads lock you create a deadlock |
02:36:00 | FromDiscord | <Rika> Why would two threads fail to acquire the lock at the same time? That kinda sounds like it defeats the purpose |
02:36:29 | arkanoid | Elegantbeef, but having the whole threaded function within a "withLock" block, the only thread able to run it would release the lock at the end of the body, and another thread would take it. I see no use of tryAcquire here |
02:36:48 | arkanoid | I know it's a silly test, but tryAcquire should not be required here |
02:36:59 | FromDiscord | <Elegantbeef> Without reproduction it's hard to say what the issue is |
02:37:03 | arkanoid | unless the lock is not automatically released at the end of the withLock block |
02:37:13 | FromDiscord | <Elegantbeef> it is |
02:37:33 | arkanoid | I'll try to reproduce a smaller example |
02:42:24 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4iSk this works as one expects |
02:49:55 | arkanoid | Elegantbeef: I'm starting questioning basic life questions now. What is happening here? https://play.nim-lang.org/#ix=4iSm |
02:52:41 | FromDiscord | <Elegantbeef> You are incrementing a value |
02:53:04 | * | Trajan joined #nim |
02:53:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ffX |
02:53:32 | arkanoid | why the dereference operator creates a copy? |
02:53:38 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4iSn |
02:53:47 | FromDiscord | <Elegantbeef> Cause that's what referencing a value type does? |
02:53:52 | FromDiscord | <Elegantbeef> derferencing rather |
02:54:14 | FromDiscord | <Elegantbeef> If you have a pointer and you say "let's get the value at the pointer" what do you expect to happen it to return a pointer? |
02:54:50 | FromDiscord | <Elegantbeef> Dereferencing is removing the pointer so `(ptr int)[] -> int` |
02:55:16 | FromDiscord | <Elegantbeef> It's the same for `ref` aswell `(ref int)[] -> int` |
02:55:18 | arkanoid | I though that assigning a variable from there would not generate a copy |
02:55:39 | FromDiscord | <Elegantbeef> It has to generate a copy cause that's what you're saying |
02:56:08 | arkanoid | well, good to know. I'm not used to unsafeland, this makes a difference. Let me fix real thing |
02:56:29 | FromDiscord | <Elegantbeef> `var accumulator = rawAccumulator[]` accumulator is to be on the stack since it's locally scoped variable |
02:56:42 | FromDiscord | <Elegantbeef> This means the onlything one can do is copy the value we get from the pointer |
02:57:14 | FromDiscord | <Elegantbeef> If you want to alias the pointer you can just do `var myAcc = rawAccumulator` |
02:57:44 | FromDiscord | <Elegantbeef> But any dereferencing unless passed into a `var int` will cause a copy just by how pointers work |
02:58:07 | FromDiscord | <Elegantbeef> since dereferencing is an L-Value it can be passed into a proc and it'll mutate the value on the heap |
02:58:09 | arkanoid | I need to learn when the dereference operator is called automatically and when not, otherwise I fear doing pointer math |
03:00:09 | FromDiscord | <Elegantbeef> In Nim it's only ever called automatically on field access |
03:01:43 | FromDiscord | <cia.gov> does std/strutils have the option to turn string to seq[byte] |
03:02:26 | arkanoid | well, no? how do you explain https://play.nim-lang.org/#ix=4iSp ? |
03:04:59 | FromDiscord | <Elegantbeef> `inc (rawAccumulator.number)` works |
03:05:24 | arkanoid | I'm puzzled now |
03:07:39 | arkanoid | I've always though f foo.bar was the same of f(foo.bar) |
03:14:47 | FromDiscord | <Elegantbeef> This is likely an issue with the field dereference on `ptr` |
03:15:15 | FromDiscord | <cia.gov> is there `^=` in nim? |
03:15:22 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4iSs works |
03:16:18 | FromDiscord | <Elegantbeef> `a = a xor b` you can always make `^=` and operator but it's a bit ambiguous |
03:16:29 | arkanoid | Elegantbeef, well, should I report it? |
03:17:20 | FromDiscord | <Elegantbeef> Well https://play.nim-lang.org/#ix=4iSu also works |
03:17:30 | * | arkurious quit (Quit: Leaving) |
03:17:38 | FromDiscord | <Elegantbeef> Yea i just trusted you |
03:17:40 | FromDiscord | <Elegantbeef> your code works |
03:18:17 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4iSv runs fine here |
03:19:45 | arkanoid | O_o |
03:21:05 | FromDiscord | <Elegantbeef> What version of Nim are you on? |
03:21:07 | FromDiscord | <Elegantbeef> And why is it like 0.1.8 😄 |
03:22:58 | arkanoid | ok, I think I've got the problem: it's random. I confirm that this code https://play.nim-lang.org/#ix=4iSv on my machine goes correct result 33%, deadlock 33%, SIGSEGV 33% |
03:23:23 | arkanoid | nim 1.6.10 |
03:23:29 | FromDiscord | <Elegantbeef> What OS/CPU |
03:23:32 | arkanoid | let me re-do skipping config files |
03:23:42 | arkanoid | x86_64 ubuntu 22.04 |
03:25:16 | FromDiscord | <Elegantbeef> When i throw it up to 100x100 i do get similar behaviour |
03:26:22 | arkanoid | what do you mean with throw it up 100x100 |
03:26:33 | FromDiscord | <Elegantbeef> `0..100` and `step == 100` |
03:26:46 | arkanoid | ah ok |
03:27:00 | FromDiscord | <Elegantbeef> Do you have fewer than 10 threads? |
03:27:32 | arkanoid | well, I get the same erroneous behaviour even with 5 threads |
03:27:39 | arkanoid | but yeas 100x100 is more frequent |
03:27:58 | FromDiscord | <Elegantbeef> I dont get it with my cpu so i can only imagine the issue is threadpools + threadcount |
03:28:17 | arkanoid | I'd correct the % to 80% correct output, 19% deadlock, 1% SIGSEGV |
03:28:41 | * | wallabra_ joined #nim |
03:30:00 | * | wallabra quit (Ping timeout: 252 seconds) |
03:30:13 | * | wallabra_ is now known as wallabra |
03:32:11 | FromDiscord | <Elegantbeef> https://github.com/status-im/nim-taskpools does work reliably but i guess it hasnt been updated for 1.6.x+ |
03:40:25 | arkanoid | I'm opening an issue on github |
03:40:45 | arkanoid | I'm thinking about the title, twice |
03:40:49 | arkanoid | any idea? |
03:41:17 | FromDiscord | <Elegantbeef> 'Threadpools can cause unreliable behaviour when saturating thread count' |
03:41:32 | FromDiscord | <Elegantbeef> Though i imagine threadpools are getting asked for taskpools and friends but idk |
03:43:09 | FromDiscord | <Elegantbeef> axed |
03:43:09 | FromDiscord | <Elegantbeef> Jesus i can write words |
03:43:33 | arkanoid | where are you reading 'Threadpools can cause unreliable behaviour when saturating thread count' |
03:44:25 | FromDiscord | <Elegantbeef> That's the title |
03:44:30 | FromDiscord | <Elegantbeef> You asked for a title |
03:45:01 | arkanoid | oh! |
03:45:07 | arkanoid | sorry, I need a coffee |
03:45:36 | arkanoid | I though you were pointing me to a hint saying that I was using std/threadpool unproperly |
03:47:56 | arkanoid | but I get same unreliable result with 10x10, that is lower than 256 |
03:49:11 | FromDiscord | <Elegantbeef> I get no issues with 10 |
03:49:30 | FromDiscord | <Elegantbeef> I mean system threads |
03:52:47 | arkanoid | I get it using 2x2 |
03:53:10 | arkanoid | this https://play.nim-lang.org/#ix=4iSD |
03:54:05 | arkanoid | I get it even with 1x1 |
03:56:02 | FromDiscord | <Elegantbeef> I do not |
03:57:32 | arkanoid | well, this is weird, when problem happens (20% of cases) it does not even print "a" https://play.nim-lang.org/#ix=4iSE |
04:02:55 | arkanoid | I will stop blaming nim, and start blaming the OS |
04:06:04 | NimEventer | New thread by jasonfi: Proposed method of defining models with Nim code in Nexus, see https://forum.nim-lang.org/t/9736 |
05:03:43 | * | Trajan quit (Quit: Client closed) |
05:17:48 | FromDiscord | <albassort> theres a memory leak directly correlated to a string array im inserting into a c function |
05:18:06 | FromDiscord | <albassort> i free the pointer on the nim side, but, somewhere in C the data is being coppied |
05:18:13 | FromDiscord | <albassort> but i cant figure out where |
05:25:49 | FromDiscord | <Elegantbeef> Did you valgrind? |
05:44:57 | FromDiscord | <albassort> turns out the massive array im making in nim isn't getting freed |
05:45:23 | FromDiscord | <albassort> i don't know if this is normal |
05:45:52 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iSS |
05:46:51 | FromDiscord | <albassort> yea i know im allocated like 1gb of data then complaining when theres a memory leak |
05:47:29 | FromDiscord | <albassort> but i would expect input to be freed after |
05:51:17 | FromDiscord | <Elegantbeef> Nim doesnt return memory to OS afaik |
05:52:30 | FromDiscord | <albassort> In reply to @Elegantbeef "Nim doesnt return memory": if thats the problem then the leak should go away if i do rand(0 ..9) |
05:52:53 | FromDiscord | <albassort> it does not |
05:53:03 | FromDiscord | <Elegantbeef> Is it actually a leak? |
05:53:26 | FromDiscord | <albassort> well, it shouldn't reclaim more memory because the arrays are of uniform size |
05:53:33 | FromDiscord | <albassort> but it continues to |
05:56:48 | FromDiscord | <albassort> actually is completely unrelated to nim |
05:56:54 | FromDiscord | <albassort> hmmm why are you so strange c |
05:58:51 | FromDiscord | <albassort> ah found it |
05:58:54 | FromDiscord | <albassort> i wasn't using deallocCStringArray |
05:58:57 | FromDiscord | <albassort> just dealloc |
06:14:51 | arkanoid | damn, I'm bridging python and nim, but being unable to use fieldPairs on objects with same field names but different types is making my work really tedius. How can I make a think that would work like this but help when there are 20+ fields? https://play.nim-lang.org/#ix=4iT1 |
06:15:31 | FromDiscord | <Elegantbeef> Why cant you use fieldPairs on objects with same name but different types? |
06:17:47 | arkanoid | Error: type mismatch: got 'NimSide' for 'inputTensor' but expected 'PySide = object' |
06:18:00 | FromDiscord | <Elegantbeef> That doesnt help |
06:20:54 | arkanoid | https://play.nim-lang.org/#ix=4iT3 |
06:22:16 | FromDiscord | <Elegantbeef> Do two for loops with `when name == nameb` |
06:26:30 | arkanoid | damn, I feed so stupid now: https://play.nim-lang.org/#ix=4iT5 ... thanks |
06:26:53 | FromDiscord | <Elegantbeef> Cheers |
06:31:36 | arkanoid | now I need to get the "float64" out of Tensor[float64] at compile time within that loop. I'm pretty sure I've done that before, don't remember the function |
06:32:27 | FromDiscord | <Elegantbeef> `typetraits.genericParams` |
06:38:40 | FromDiscord | <Elegantbeef> Can also do something like `typeof(myTensor[0])` or whatever accessor returns a float |
06:39:55 | arkanoid | n = asNumpyArray[genericParams(n.type).get(0)](p).toTensor compiled nicely! |
06:40:03 | arkanoid | let's hope about the tests ... |
06:51:30 | FromDiscord | <cia.gov> why is everyone a bot? |
06:52:48 | * | v9fk joined #nim |
06:53:32 | FromDiscord | <Elegantbeef> Matrix + irc |
06:55:06 | * | v9fk quit (Remote host closed the connection) |
06:55:32 | * | v9fk joined #nim |
06:59:25 | FromDiscord | <Bung> @cia.gov\: why given that nick name? make me feel monitored |
06:59:36 | FromDiscord | <cia.gov> 😈 |
07:18:01 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
08:04:34 | FromDiscord | <Bung> what's "ICE" in issue ? |
08:05:47 | FromDiscord | <Elegantbeef> Internal compiler error |
08:08:15 | FromDiscord | <Bung> is that abbreviation widely used? I can't get it from google |
08:09:44 | FromDiscord | <Elegantbeef> for compile development i think so |
08:13:56 | FromDiscord | <ShalokShalom> There is a AI code assistant, that supports Nim and is free by default:↵↵https://replit.com/site/ghostwriter |
08:31:21 | FromDiscord | <demotomohiro> IC = incremental compile↵ICE = internal compile error↵Abbreviations I saw on Nim chat/forum. |
08:33:32 | FromDiscord | <ShalokShalom> Kill all abbreviations |
08:33:42 | FromDiscord | <ShalokShalom> With fire please |
08:33:54 | FromDiscord | <ShalokShalom> thanks |
08:34:00 | FromDiscord | <Luckayla> Internal Combustion Engine |
08:34:21 | FromDiscord | <ShalokShalom> ICE is a type of train in Germany |
08:34:30 | FromDiscord | <Luckayla> It's a type of frozen water as well |
08:34:39 | FromDiscord | <Elegantbeef> No that's ice |
08:34:48 | FromDiscord | <Bung> 🙄 |
08:35:13 | FromDiscord | <Bung> well it's "U.S. Immigration and Customs Enforcement" on top of google result |
08:35:17 | FromDiscord | <ShalokShalom> "Oh, make your code explicitly and unambiguous" |
08:35:24 | FromDiscord | <Luckayla> In reply to @Elegantbeef "No that's ice": No you're thinking of methamphetamine |
08:35:29 | FromDiscord | <ShalokShalom> "Also, abbreviate everything" |
08:35:41 | FromDiscord | <ShalokShalom> 🤦♂️ |
08:35:54 | FromDiscord | <ShalokShalom> (edit) "explicitly" => "explicit" |
08:35:56 | FromDiscord | <Elegantbeef> No one abbreviates it in the code |
08:36:16 | FromDiscord | <ShalokShalom> Everything in Nim is abbreviated |
08:36:20 | FromDiscord | <Elegantbeef> People only abbreviate it talking about it cause no one wants to say internal compiler error |
08:36:28 | FromDiscord | <Elegantbeef> "Everything" |
08:36:32 | FromDiscord | <ShalokShalom> Even the name of the language 😄 |
08:36:42 | FromDiscord | <Elegantbeef> Nim isnt technically abbreviated |
08:36:48 | FromDiscord | <Elegantbeef> It's completely removed from Nimrod |
08:36:49 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef ""Everything"": Well, the libraries, the keywords etc |
08:37:02 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "It's completely removed from": I am joking |
08:37:19 | FromDiscord | <ShalokShalom> But its not even that far from the truth 😅 |
08:37:32 | FromDiscord | <Elegantbeef> Are the libraries really abbreviated? |
08:38:13 | FromDiscord | <Elegantbeef> `parseutils` is a sensible shortening of `parseutilities` |
08:38:37 | FromDiscord | <Elegantbeef> I guess they're, but it's in the least inane way |
08:38:43 | FromDiscord | <Elegantbeef> It's not like it's `import std/pu` |
08:44:39 | * | pro joined #nim |
09:02:39 | * | pro left #nim (#nim) |
09:19:16 | FromDiscord | <xoich (xoich)> anybody uses emacs with nim-mode? If so, how can you do without imenu? |
09:37:07 | * | krux02 joined #nim |
09:39:21 | FromDiscord | <xoich (xoich)> sent a code paste, see https://play.nim-lang.org/#ix=4iTI |
09:41:05 | FromDiscord | <xoich (xoich)> sent a code paste, see https://play.nim-lang.org/#ix=4iTJ |
10:09:20 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Are the libraries really": Well, I mean the method names |
10:09:32 | FromDiscord | <ShalokShalom> StrLibSgedBags |
10:09:44 | FromDiscord | <ShalokShalom> That's how most stuff reads to me :nim2: |
10:10:08 | FromDiscord | <ShalokShalom> (edit) "method" => "method/function" | "method/functionnames ... " added "whatever" |
10:26:29 | * | ltriant joined #nim |
10:31:18 | * | ltriant quit (Ping timeout: 252 seconds) |
10:34:48 | * | ltriant joined #nim |
10:36:07 | * | v9fk quit (Remote host closed the connection) |
10:38:35 | FromDiscord | <xoich (xoich)> is there something like python's dict.update for Tables? |
10:41:52 | * | v9fk joined #nim |
10:42:00 | * | ltriant quit (Ping timeout: 272 seconds) |
10:47:35 | * | v9fk quit (Remote host closed the connection) |
10:51:27 | * | v9fk joined #nim |
10:58:18 | * | krux02 quit (Remote host closed the connection) |
11:02:25 | * | ltriant joined #nim |
11:07:14 | * | ltriant quit (Ping timeout: 252 seconds) |
11:26:02 | * | gshumway quit (Quit: .) |
11:31:41 | * | gshumway joined #nim |
11:48:59 | FromDiscord | <auxym> not tot my knowledge, but it's a 2 line proc to implement |
11:51:49 | FromDiscord | <jmgomez> In reply to @deech "Anyone know of a": I dont get why out only works on imported types |
11:51:56 | FromDiscord | <<She>Horizon</Her>> What would be the usecase for using a Golang library on Nim? Iirc Go has... Massive binaries which isn't exactly fun |
11:52:15 | FromDiscord | <<She>Horizon</Her>> The size doesn't matter nowadays but is annoying |
11:52:21 | FromDiscord | <jmgomez> In reply to @Event Horizon "What would be the": ecosystem without worrying for the mm? |
11:52:24 | * | ltriant joined #nim |
11:53:24 | FromDiscord | <<She>Horizon</Her>> Wdym? Why would you need to worry about memory management? |
11:53:32 | FromDiscord | <<She>Horizon</Her>> Because Go uses it's own GC to manage it? |
11:56:27 | FromDiscord | <jmgomez> Yup |
11:56:50 | FromDiscord | <<She>Horizon</Her>> Ah, alright then |
11:57:23 | * | ltriant quit (Ping timeout: 268 seconds) |
12:00:07 | * | v9fk quit (Remote host closed the connection) |
12:01:08 | * | v9fk joined #nim |
12:02:48 | * | v9fk quit (Remote host closed the connection) |
12:03:38 | * | v9fk joined #nim |
12:13:23 | * | ltriant joined #nim |
12:20:48 | * | ltriant quit (Ping timeout: 272 seconds) |
13:15:07 | FromDiscord | <0x454d505459> sent a code paste, see https://play.nim-lang.org/#ix=4iUy |
13:15:30 | FromDiscord | <0x454d505459> (edit) "https://play.nim-lang.org/#ix=4iUy" => "https://play.nim-lang.org/#ix=4iUz" |
13:21:33 | FromDiscord | <0x454d505459> sent a code paste, see https://play.nim-lang.org/#ix=4iUB |
13:21:40 | FromDiscord | <0x454d505459> (edit) "https://play.nim-lang.org/#ix=4iUB" => "https://play.nim-lang.org/#ix=4iUC" |
13:24:34 | * | ltriant joined #nim |
13:29:22 | * | ltriant quit (Ping timeout: 252 seconds) |
14:10:26 | FromDiscord | <Phil> In reply to @0x454d505459 "`execShellCmd` from the os": I was about to mention that one since its mentioned to be more terminal-like, do you want to avoid it? |
14:10:48 | FromDiscord | <0x454d505459> In reply to @Isofruit "I was about to": I would like to avoid it has it spawns a shell |
14:11:18 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Fa5 |
14:13:13 | FromDiscord | <Phil> In reply to @0x454d505459 "I would like to": So you want a terminal without a shell? That's a tough one |
14:13:19 | FromDiscord | <0x454d505459> yes |
14:13:38 | FromDiscord | <0x454d505459> ig I can look into C's "system" definition |
14:14:12 | FromDiscord | <Phil> That's a smidge too low level for me sadly. Nim does have a posix wrapper though, if you're familiar with that you could look in there |
14:14:52 | FromDiscord | <0x454d505459> Its a too low level for me too, but I could still take a look at it |
14:16:32 | FromDiscord | <0x454d505459> sent a long message, see http://ix.io/4iUS |
14:16:48 | FromDiscord | <Phil> Why nano of all things btw? Since nano specifically seems to need a terminal |
14:17:48 | FromDiscord | <0x454d505459> just to test, but su doesn't work either and all programs requiring a terminal doesn't want to work, others works but outputs weirdly |
14:20:25 | pbsds | Hi, my brain is especially smooth today, how to i convert a string to a bitset of chars? |
14:20:49 | pbsds | i can't seem to find any bitset constructors |
14:30:46 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4iUW |
14:34:41 | pbsds | huh, totally glossed over that module, thanks |
14:46:49 | FromDiscord | <albassort> is there a way to get the name of the the file in which code is being run from |
14:48:05 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#currentSourcePath.t |
14:48:10 | FromDiscord | <rakgew> os.getAppFileName.lastPathPart iirc |
14:49:55 | FromDiscord | <Rika> Oh, I misread |
14:49:57 | FromDiscord | <Rika> Yes |
14:50:07 | FromDiscord | <Rika> The other guy is correct |
14:52:20 | FromDiscord | <ajusa> Any way to parse exif in Nim? I don't see any native libraries, is binding to a C library my best option? |
14:52:32 | FromDiscord | <ajusa> (edit) "Any way to parse ... exif" added "jpeg " |
14:53:57 | FromDiscord | <albassort> exif? |
14:54:03 | FromDiscord | <albassort> theres a few jpg libraries |
14:54:09 | FromDiscord | <albassort> but idk what exif is |
14:58:17 | FromDiscord | <ajusa> In reply to @albassort "but idk what exif": It's the metadata headers in a JPEG, includes make and model of a camera, date/time, etc. |
14:59:14 | FromDiscord | <albassort> @ajusa https://github.com/flenniken/metar |
15:00:11 | FromDiscord | <4zv4l> how can I get a pointer/reference to a `const string` ? |
15:00:18 | FromDiscord | <ajusa> In reply to @albassort "<@102899813149855744> https://github.com/flenniken/": Oh perfect, thanks! Guess I was too specialized with my search query |
15:00:23 | FromDiscord | <4zv4l> or that's the point it should be `let string` |
15:00:43 | FromDiscord | <albassort> const is for compile time constants, probably not lol |
15:00:54 | FromDiscord | <albassort> let is for immutable variables, so the pointer will be immutable |
15:01:02 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/ysl |
15:01:31 | FromDiscord | <albassort> better to cast it to a cstring if you're gonna use it as a pointer but what you should do instead is this |
15:01:40 | FromDiscord | <4zv4l> yeah my bad, it's because in C it passes the pointers anyway even with `define` |
15:01:55 | FromDiscord | <albassort> sent a code paste, see https://paste.rs/DyV |
15:02:14 | FromDiscord | <albassort> this is... if you NEED a pointer |
15:02:18 | FromDiscord | <4zv4l> In reply to @albassort "better to cast it": the compiler tells me it's bad |
15:02:23 | FromDiscord | <albassort> hmm |
15:02:30 | FromDiscord | <4zv4l> to cast string to cstring |
15:02:43 | FromDiscord | <4zv4l> except if I create it as cstring from the beginning obviously |
15:02:45 | FromDiscord | <4zv4l> I'll try that |
15:02:48 | FromDiscord | <albassort> yea... |
15:03:02 | FromDiscord | <4zv4l> but I don't get why it has no addresses |
15:03:11 | FromDiscord | <4zv4l> it's a string in memory, it must have an address |
15:03:18 | FromDiscord | <albassort> why are you using a string here anyway |
15:03:27 | FromDiscord | <4zv4l> because write take a pointer to a cstring |
15:03:30 | FromDiscord | <4zv4l> (edit) "take" => "takes" |
15:03:35 | FromDiscord | <albassort> oi m8 |
15:03:44 | FromDiscord | <albassort> you tried to put a nim string as a cstring |
15:03:57 | FromDiscord | <albassort> and you ask why it doesn't have an address |
15:04:00 | FromDiscord | <4zv4l> I tried this too |
15:04:03 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVc |
15:04:04 | * | ltriant joined #nim |
15:04:26 | FromDiscord | <albassort> try it as var |
15:04:28 | FromDiscord | <albassort> and if not |
15:04:47 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iVd |
15:04:51 | FromDiscord | <albassort> would work fine |
15:04:53 | FromDiscord | <4zv4l> `Error: type expected` |
15:05:02 | FromDiscord | <albassort> uh what |
15:05:02 | FromDiscord | <Rika> What version is your compiler |
15:05:06 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVe |
15:05:15 | FromDiscord | <4zv4l> Nim Compiler Version 1.6.6 |
15:05:18 | FromDiscord | <Rika> If your compiler version is old, let variables need to use unsafe addr |
15:05:28 | FromDiscord | <Rika> In reply to @4zv4l "`Error: expression has no": Says here |
15:05:48 | FromDiscord | <albassort> listen to rika he smort and i dont wanna deal with this |
15:05:51 | FromDiscord | <albassort> :) |
15:06:07 | FromDiscord | <4zv4l> In reply to @Rika "If your compiler version": is 1.6.6 old ? |
15:06:09 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4iVg |
15:06:14 | FromDiscord | <4zv4l> well I just want to pass a pointer to my string |
15:06:19 | FromDiscord | <Rika> I don’t know if it changed but I assume it is |
15:06:19 | FromDiscord | <4zv4l> but it seems not to work |
15:06:26 | FromDiscord | <Rika> Devel I think doesn’t have that issue |
15:06:28 | FromDiscord | <albassort> devel is currently 1.7.3 |
15:06:29 | FromDiscord | <Phil> You want to print to stdout from what I'm seeing |
15:06:37 | FromDiscord | <Phil> That doesn't need a cstring |
15:06:39 | FromDiscord | <<She>Horizon</Her>> In reply to @4zv4l "is 1.6.6 old ?": Yeah, 1.6.10 is the latest stable |
15:06:51 | FromDiscord | <Rika> In reply to @Isofruit "You want to print": It could be just an example |
15:06:52 | FromDiscord | <Phil> And 1.6.6 is not that old, only like a year or so |
15:07:01 | FromDiscord | <albassort> thats old as f |
15:07:03 | FromDiscord | <albassort> (edit) "as f" => "asf" |
15:07:07 | FromDiscord | <<She>Horizon</Her>> Yeah but still better to use the latest possible xD |
15:07:11 | FromDiscord | <Phil> I started with 1.6.6 so its fresh xP |
15:07:28 | FromDiscord | <albassort> bald people smfh |
15:09:00 | FromDiscord | <4zv4l> alright, I'm updating |
15:09:16 | * | ltriant quit (Ping timeout: 272 seconds) |
15:09:40 | FromDiscord | <4zv4l> just to explain a bit |
15:10:03 | FromDiscord | <4zv4l> I just made a small code in Zig which is really small and does really few syscall↵and since I love Nim I wanna check if I can achieve the same |
15:10:10 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVj |
15:10:11 | FromDiscord | <4zv4l> but so in Nim |
15:11:17 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVk |
15:13:13 | FromDiscord | <4zv4l> unsafeAddr works with string |
15:13:18 | FromDiscord | <4zv4l> now (not with the previous one) |
15:19:13 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVl |
15:21:02 | FromDiscord | <4zv4l> Error: unhandled exception: index out of bounds, the container is empty [IndexDefect] |
15:22:20 | FromDiscord | <4zv4l> read from stdout lmao ok |
15:24:12 | FromDiscord | <4zv4l> still index out of bounds tho |
15:24:44 | FromDiscord | <4zv4l> oh because the string is empty at first |
15:25:09 | * | moonlit quit (Ping timeout: 265 seconds) |
15:29:31 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVm |
15:35:40 | FromDiscord | <Rika> “Not well displayed” in what way? |
15:36:46 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVo |
15:36:48 | FromDiscord | <4zv4l> the Simon is the name↵the 20 is the age |
15:36:54 | FromDiscord | <4zv4l> so the prompt before are weird |
15:36:57 | FromDiscord | <4zv4l> same goes for the greet |
15:38:23 | FromDiscord | <4zv4l> this is the current code |
15:38:24 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVp |
15:43:37 | FromDiscord | <4zv4l> any idea ? |
15:46:40 | FromDiscord | <ringabout> In reply to @4zv4l "any idea ?": You can get the address of strings by `unsafeAddr s` because s is not a pointer, you should use `unsafeAddr s[0]` |
15:47:00 | FromDiscord | <Vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4iVr |
15:47:12 | FromDiscord | <4zv4l> In reply to @Vindaar "why so complicated in": yes but I try to make it using as few syscalls as possible |
15:47:34 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVs |
15:47:37 | FromDiscord | <4zv4l> and I want to try achieving the same in nim |
15:47:43 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4iVt |
15:48:34 | FromDiscord | <4zv4l> In reply to @ringabout "You can get the": thanks, that works indeed ! |
15:48:49 | FromDiscord | <4zv4l> what's the difference between the address of the string and of s[0] ? |
15:48:53 | FromDiscord | <4zv4l> shouldn't it be the same ? |
15:49:43 | FromDiscord | <Vindaar> In reply to @4zv4l "what's the difference between": a string is not just a pointer to data. It's essentially a ptr + length pair. By accessing the address to `s[0]` you get the address to the start of the data (which is what you want). Address to the string itself points to the ptr + len pair object |
15:50:19 | FromDiscord | <ringabout> It is a struct, you can get the address of its length by `addr s`. |
15:50:36 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4iVw |
15:50:56 | FromDiscord | <4zv4l> alright yes makes sense |
15:51:42 | FromDiscord | <Rika> I forgot that :InaTehe: |
15:53:12 | FromDiscord | <4zv4l> I don't know nim enough, how can I get rid of all those syscalls to prepare the runtime env ? |
15:53:40 | FromDiscord | <albassort> you are writing nim as if it were... |
15:53:44 | FromDiscord | <albassort> i dont even know |
15:54:04 | FromDiscord | <4zv4l> well you can disable the gc so why not ? |
15:54:22 | FromDiscord | <4zv4l> and some write Nim on freestanding right ? |
15:54:30 | FromDiscord | <albassort> so, you can do it |
15:54:48 | FromDiscord | <albassort> but how are you going to free all the variables called by the stdlib which was written without that in mind |
15:54:49 | FromDiscord | <albassort> you cant |
15:55:03 | FromDiscord | <albassort> not even /system/ is written without the gc in mind |
15:55:12 | FromDiscord | <4zv4l> I mean I don't say it's possible↵I just wanna know how easily (if that's possible) it is to achieve this but in Nim https://media.discordapp.net/attachments/371759389889003532/1054064294561599508/image.png |
15:55:15 | FromDiscord | <albassort> so you cant even write 2+2 without memoy being allocated and not fred |
15:55:17 | FromDiscord | <albassort> (edit) "fred" => "freed" |
15:55:29 | FromDiscord | <albassort> (you probably can but thats besides the point) |
15:55:56 | FromDiscord | <4zv4l> In reply to @albassort "so you cant even": really ? |
15:56:10 | FromDiscord | <albassort> that might be an over exaggeration |
15:56:17 | FromDiscord | <albassort> but its close to that effect |
15:56:35 | FromDiscord | <albassort> besides |
15:56:39 | FromDiscord | <albassort> modern nim doesn't even use a gc |
15:56:49 | FromDiscord | <albassort> we use ORC and ARC |
15:56:58 | FromDiscord | <4zv4l> orc technically is a gc isn't it ? |
15:57:06 | FromDiscord | <albassort> it is technically not |
15:57:22 | FromDiscord | <albassort> well |
15:57:24 | FromDiscord | <albassort> ehh |
15:57:27 | FromDiscord | <albassort> its kinda merky |
15:57:28 | FromDiscord | <4zv4l> I thought arc wasn't but orc was |
15:57:43 | FromDiscord | <albassort> im not sure... |
15:57:45 | FromDiscord | <albassort> they might both be |
15:57:47 | FromDiscord | <4zv4l> well I guess I'll keep Nim as my middle level language |
15:57:48 | FromDiscord | <albassort> or both not be |
15:58:57 | FromDiscord | <albassort> i don't know. It works pretty close to Rust, Zig and C |
15:59:10 | FromDiscord | <albassort> its high level as is all of them |
15:59:30 | FromDiscord | <4zv4l> well Zig is lower level than C sometimes↵so I keep Zig as my low level language↵really easy to do freestanding with it also, easier than C |
15:59:33 | FromDiscord | <albassort> relegating it to "midlde level" is pretty reductive, and i dont think it fills that niche |
15:59:38 | FromDiscord | <4zv4l> oh |
15:59:40 | FromDiscord | <4zv4l> not reductive |
15:59:44 | FromDiscord | <4zv4l> that's the most used level to me |
16:00:03 | FromDiscord | <4zv4l> I rarely need low level control |
16:00:14 | FromDiscord | <albassort> so, in the land of nim, we don't usually use pointers |
16:00:14 | FromDiscord | <4zv4l> I more need Perl/Nim of High and Middle level respectively |
16:00:23 | FromDiscord | <4zv4l> In reply to @albassort "so, in the land": yeah I start to get that |
16:00:43 | FromDiscord | <albassort> because of how unsafe they are, where you might use pointers, we use explicit references |
16:00:50 | FromDiscord | <albassort> ref string for example |
16:01:07 | FromDiscord | <albassort> its a reference to a piece of memory, that cant be cleared or taken away as long as it is preserved as a reference (unlike var) |
16:01:45 | FromDiscord | <4zv4l> yeah I heard about ref |
16:06:09 | FromDiscord | <albassort> generally speaking, pointers are used for 3 things↵1. interop↵2. manual gc, where you dont trust the gc for whatever reason↵3. storing data on the shared heap to communicate between threeads |
16:06:16 | FromDiscord | <albassort> (edit) "threeads" => "threads" |
16:06:43 | FromDiscord | <albassort> ref and var fulfills the other purposes you would use them in C |
16:06:48 | FromDiscord | <albassort> e.g |
16:07:28 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iVB |
16:07:43 | FromDiscord | <albassort> this would set the incoming string to "example" and return the length of it |
16:08:39 | FromDiscord | <albassort> (edit) "length" => "max()" |
16:09:12 | FromDiscord | <albassort> additionally, strings in nim are pascal style and correspond to an integer value of their length, and are non-null terminated |
16:10:17 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iVC |
16:10:32 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4iVC" => "https://play.nim-lang.org/#ix=4iVD" |
16:10:39 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4iVD" => "https://play.nim-lang.org/#ix=4iVE" |
16:13:12 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iVG |
16:13:20 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4iVG" => "https://play.nim-lang.org/#ix=4iVH" |
16:13:48 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4iVI |
16:13:58 | FromDiscord | <4zv4l> In reply to @4zv4l "I mean I don't": Again I wanted to do something similar to this |
16:14:07 | FromDiscord | <4zv4l> So that was the purpose to be low level |
16:14:21 | FromDiscord | <albassort> but.... why? |
16:14:47 | FromDiscord | <albassort> for what aim |
16:15:13 | FromDiscord | <albassort> it probably looks the same on the output, except your code has less room for the compiler to make optimal |
16:23:07 | FromDiscord | <auxym> In reply to @4zv4l "I mean I don't": I don't know enough rust to understand that. But basically if you want to write nim with `--mm:none`, you have to avoid all strings and seqs, and everything that uses them (eg tables hashsets deques all are implemented with seqs). And ref objects but that's sort of obvious. But really with ARC there is very little reason to do so. |
16:24:18 | FromDiscord | <auxym> The only exception is maybe embedded with small heap where you are worried about fragmentation. But even then you can still use ARC but be careful and mindful about allocation (reuse seq/strings like buffers instead of reallocating a new one, etc) |
16:25:37 | FromDiscord | <auxym> if you compile with mm:none and anything in your code uses ref/seq/string, you will get a compiler error btw (not a silent memory leak) |
16:28:33 | FromDiscord | <Rika> Makes me wonder if that context idea that Odin and I believe Zig also has is a good idea for embedded |
16:36:54 | arkanoid | To generate a .dll from intended to be loaded from Nim and not C or whatever, do I need exportc? |
16:37:10 | arkanoid | *from nim |
16:44:17 | FromDiscord | <<She>Horizon</Her>> Yeah you would |
16:44:32 | arkanoid | Ok |
16:44:40 | FromDiscord | <<She>Horizon</Her>> `exportc` and `cdecl`, since to load a method in a dll, you still need the exact name |
16:45:13 | FromDiscord | <<She>Horizon</Her>> And it'd be mangled in Nim compiled code, so |
17:03:55 | FromDiscord | <ShalokShalom> In reply to @4zv4l "orc technically is a": rc means reference counting |
17:04:08 | FromDiscord | <ShalokShalom> Technically, thats not GC |
17:04:17 | FromDiscord | <ShalokShalom> but has some properties of it |
17:04:26 | FromDiscord | <ShalokShalom> Actually, ORC is unique 😄 |
17:05:40 | * | ltriant joined #nim |
17:06:04 | arkanoid | And what if I want to export a ref type to generated dll, such that users can use it at compile time to extend the type contained into the dll? |
17:06:06 | FromDiscord | <ringabout> How could ORC be unique, there is a mainstream language uses the rc + partial tracing. |
17:08:44 | FromDiscord | <4zv4l> In reply to @auxym "I don't know enough": It’s zig not rust, but thanks↵Yeah I tried none as gc |
17:10:08 | FromDiscord | <4zv4l> In reply to @albassort "but.... why?": Much less syscalls |
17:10:39 | * | ltriant quit (Ping timeout: 268 seconds) |
17:15:51 | FromDiscord | <auxym> In reply to @arkanoid "And what if I": you can't use a dll at compile time |
17:17:05 | arkanoid | auxym, I mean being able to import types from dll and extend them in my nim code |
17:17:48 | arkanoid | I'm just saying that I don't need this at runtime (plugin like) but just at link time |
17:17:53 | FromDiscord | <auxym> as in a inheritance? pretty sure you can't do that either |
17:18:16 | arkanoid | No? |
17:20:40 | arkanoid | And what if I export/import only the non-ref types and then declare the OOP type hierarchy only in the Nim side? |
17:21:34 | FromDiscord | <auxym> not sure. you could use composition style instead of inheritance though |
17:22:43 | arkanoid | Auxym I've tried, but object variant is not flexible enough to cover the requirements. I have variants sharing field names with other variants, but not type |
17:23:13 | arkanoid | I managed to get it work only with inheritance |
17:27:23 | FromDiscord | <ShalokShalom> In reply to @arkanoid "Auxym I've tried, but": you mean you are limited by object variants limitation of all being in one namespace? |
17:37:14 | * | ltriant joined #nim |
17:38:51 | FromDiscord | <albassort> In reply to @auxym "you can't use a": cant you statically link it? |
17:39:59 | FromDiscord | <albassort> i tried to compile with musl today and i learned its annoying to statically link gtk |
17:40:12 | FromDiscord | <albassort> but for good reasons |
17:41:22 | FromDiscord | <ShalokShalom> gtk is annoying to use for good reasons |
17:41:29 | FromDiscord | <ShalokShalom> you could start to work for gnome 😛 |
17:41:51 | FromDiscord | <ShalokShalom> statically linking is something that they culturally dont like |
17:42:05 | FromDiscord | <ShalokShalom> this is why lgpl doesnt allow it and mpl 2 does |
17:42:11 | FromDiscord | <ShalokShalom> different cultures |
17:42:19 | * | ltriant quit (Ping timeout: 256 seconds) |
17:43:04 | FromDiscord | <albassort> I would never work for gnome |
17:43:25 | FromDiscord | <albassort> i feel the smell of miasma from their rotting code would overwhelm their offices |
17:44:56 | FromDiscord | <albassort> I genuinely think GTK is the least evil framework tho |
17:45:04 | FromDiscord | <albassort> its fucked, super fucked |
17:45:07 | FromDiscord | <albassort> but QT is worse |
17:53:28 | FromDiscord | <ShalokShalom> https://medium.com/swlh/what-makes-godot-engine-great-for-advance-gui-applications-b1cfb941df3b |
17:53:41 | FromDiscord | <ShalokShalom> I would normally disagree, but ... |
17:53:47 | FromDiscord | <ShalokShalom> Ah, what the heck |
17:54:00 | FromDiscord | <ShalokShalom> https://www.youtube.com/watch?v=ON0A1dsQOV0 |
17:54:14 | FromDiscord | <ShalokShalom> I disagree strongly |
18:08:48 | * | ltriant joined #nim |
18:14:12 | * | ltriant quit (Ping timeout: 272 seconds) |
18:14:27 | FromDiscord | <albassort> idk man |
18:14:40 | FromDiscord | <albassort> @ShalokShalom writing gtk was very very easy for me |
18:14:52 | FromDiscord | <albassort> i tried to write QT and just got annoyed |
18:22:21 | FromDiscord | <ShalokShalom> The Nim bindings of GTK seems very reasonable |
18:22:34 | FromDiscord | <ShalokShalom> At least subjectively, and on first sight |
18:23:03 | FromDiscord | <ShalokShalom> And I dont love Qt as a developer, neither do I think its the best in town. |
18:25:00 | FromDiscord | <arkanoid> Android/iOS/Windows/OSX platform specific GUI istuff is the best in town |
18:31:24 | FromDiscord | <ShalokShalom> you mean like, not only native looking widgets |
18:31:31 | FromDiscord | <ShalokShalom> but rewriting the app several times |
18:31:40 | FromDiscord | <ShalokShalom> and using actual native GUIs every time |
18:33:33 | * | arkurious joined #nim |
18:47:47 | * | moonlit joined #nim |
18:49:22 | * | xet7 joined #nim |
19:15:33 | FromDiscord | <albassort> In reply to @ShalokShalom "The Nim bindings of": they don't compile on my machine :) |
19:16:47 | FromDiscord | <albassort> In reply to @arkanoid "Android/iOS/Windows/OSX platform specific GUI": Yea because if you give anything challenging to a mobile developer they might freekout |
19:16:58 | FromDiscord | <albassort> they're scared of programming |
19:17:59 | arkanoid | after a lot of fighting with vscode + nimsuggest/nimlsp/nimlangserv that ends in nimsuggest eating >10GB ram and crashing my machine, I've finally found an equilibrium: set "Nim: Provider" in vscode extension to "none" |
19:18:59 | FromDiscord | <albassort> In reply to @arkanoid "after a lot of": WAIT WHAT |
19:19:13 | FromDiscord | <albassort> does that fix the problems? |
19:19:26 | arkanoid | albassort, in my case, yes |
19:19:43 | FromDiscord | <albassort> In reply to @arkanoid "after a lot of": ((btw setup swap and set swapiness low, so, if it starts to consume ram it'll be killed and wont crash your pc) |
19:19:45 | FromDiscord | <albassort> (edit) "pc)" => "pc))" |
19:20:04 | FromDiscord | <albassort> my pc is relatively stable like that |
19:20:12 | FromDiscord | <albassort> 8 gb ram 20 gb swap for me |
19:20:35 | arkanoid | albassort, I do kinda scientific computing, I know how to handle swappiness, and also I know that I don't want my developing environment to be the elephant in the room while doing so |
19:21:05 | FromDiscord | <albassort> im sorry i wasn't trying to alba-splain ;-; |
19:21:13 | arkanoid | np |
19:22:02 | FromDiscord | <albassort> For me it works because, when i do scientific-like computing, lately, it hasn't been long workloads |
19:22:21 | FromDiscord | <albassort> but if i was doing any computations that take a long time, yea... its bad |
19:28:02 | arkanoid | setting "Nim: Provider" in vscode extension to "none" but enabling "lint on save" (nim check on save) gives me the best experience. I know what I've done wrong FASTER than before, because nimsuggest is no more clogging the editor |
19:31:56 | arkanoid | by watching htop filtering processes containing "nim" in executable, I see zero nim-related processes while editing, and as soon as I save the file I am editing I see ".nimble/bin/nim check" starting up, that calls "nim check --listFullPaths src/myproject.nim" from .choosenim folder, and within a second it completes and I see where the error is in vscode |
19:33:23 | arkanoid | 100% better than having autocompletion or type info after 10 seconds, while clogging the ram of my pc and fighting with "project paths" to make vscode extension/nimlsp/nimlangserver able to control which nimsuggest processes went crazy |
19:38:34 | arkanoid | moreover I still get most of autocompletion out of this for mysterious reasons |
19:44:19 | * | ltriant joined #nim |
19:49:25 | * | ltriant quit (Ping timeout: 260 seconds) |
19:50:43 | FromDiscord | <ShalokShalom> In reply to @albassort "they don't compile on": Well, they are early |
19:50:55 | FromDiscord | <ShalokShalom> Might still improve 🙂 |
19:51:00 | FromDiscord | <ShalokShalom> Did you bug report? |
19:57:59 | FromDiscord | <ShalokShalom> @arkanoid Very interesting 😮 |
19:58:32 | FromDiscord | <albassort> In reply to @ShalokShalom "Did you bug report?": the bug is known, they think they solved it, they didn't |
19:58:38 | FromDiscord | <albassort> its probably my machine |
19:58:46 | FromDiscord | <albassort> so it'll be fin |
19:58:48 | FromDiscord | <albassort> (edit) "fin" => "fine" |
19:58:53 | FromDiscord | <albassort> code was already written in C |
20:14:30 | FromDiscord | <ShalokShalom> You surely have updated to their newest version? |
20:24:10 | * | wallabra joined #nim |
20:28:48 | * | wallabra_ joined #nim |
20:30:40 | * | wallabra quit (Ping timeout: 252 seconds) |
20:30:40 | * | wallabra_ is now known as wallabra |
20:32:54 | * | ltriant joined #nim |
21:08:46 | FromDiscord | <fabricio> how can I pass a named closure iterator around as a value, because I think when I do that the compiler thinks that I'm trying to call it |
21:14:34 | FromDiscord | <Phil> Not that I can help you, I have during my year of nim not once had to define my own iterator, but a code-example for others that have the knowledge could be useful.↵Maybe Beef decends upon you with his wisdom |
21:14:58 | FromDiscord | <Phil> (edit) "decends" => "descends" |
21:22:39 | FromDiscord | <Elegantbeef> They're probably doing `myProc(myIterator())` |
21:24:55 | FromDiscord | <0x454d505459> Anyone ever use nimqml ? after compiling the examples I get module not founds, |
21:24:56 | FromDiscord | <0x454d505459> (edit) "founds," => "founds" |
21:25:08 | FromDiscord | <0x454d505459> is there anything extra to do ? |
21:25:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iXp |
21:27:52 | FromDiscord | <Phil> In reply to @0x454d505459 "Anyone ever use nimqml": I have a couple mini examples and my next larger project I wanted to do with nimqml, what issue are you running into exactly? |
21:28:05 | FromDiscord | <Phil> As in, please copy paste the error 😛 |
21:29:25 | FromDiscord | <0x454d505459> In reply to @Isofruit "I have a couple": Just trying it out↵`file:///tmp/nimqml/examples/helloworld/main.qml:2:1: module "QtQuick.Controls" version 1.2 is not installed` |
21:30:33 | FromDiscord | <0x454d505459> just compiling the examples after building them |
21:30:58 | FromDiscord | <Phil> Ahh you may need to install the necessary QT packages, let me check which ones those were on arch |
21:31:16 | FromDiscord | <0x454d505459> I have kirigami2 installed |
21:31:35 | FromDiscord | <Phil> In reply to @0x454d505459 "I have kirigami2 installed": You using arch or debian/ubuntu-based? |
21:31:40 | FromDiscord | <0x454d505459> arch based |
21:32:58 | FromDiscord | <Phil> sent a long message, see http://ix.io/4iXs |
21:33:26 | FromDiscord | <Phil> (pacman -q |
21:33:27 | FromDiscord | <Phil> (edit) "-q" => "-q)" |
21:33:32 | FromDiscord | <Phil> (edit) "-q)" => "-Q)" |
21:34:00 | FromDiscord | <0x454d505459> I have all of them |
21:34:04 | * | ltriant quit (Ping timeout: 260 seconds) |
21:34:17 | FromDiscord | <0x454d505459> I use kde plasma so I guess they came with it |
21:34:21 | FromDiscord | <0x454d505459> (edit) "I use kde plasma so I guess they came with it ... " added "as dependencies" |
21:34:54 | FromDiscord | <Phil> Ahhh check, I use gnome so I had to install those, I think another issue I ran into that because arch is arch you already don't have 1.2 anymore but a newer version, you should be able to just drop the version number from the qml files |
21:35:16 | FromDiscord | <Phil> If you want to figure out what version you're currently running I'm like 30% sure it's 2.2x something |
21:35:38 | FromDiscord | <0x454d505459> if I just remove the versions it will auto select right ? |
21:35:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4iXv |
21:36:16 | FromDiscord | <Phil> This compiles under arch with nimqml (if you pass the right context object for rendering) |
21:36:38 | FromDiscord | <0x454d505459> now it says gtk2 module isn't installed (but it isn't imported) |
21:37:44 | FromDiscord | <Phil> That also sounds familiar, could you say again which module its complaining about precisely? |
21:38:05 | FromDiscord | <Phil> Because I also had to install `gtk2 2.24.33-2` |
21:38:32 | FromDiscord | <0x454d505459> `file:///tmp/nimqml/examples/helloworld/main.qml: module "gtk2" is not installed` |
21:38:47 | FromDiscord | <0x454d505459> In reply to @Isofruit "Because I also had": I have it installed |
21:40:08 | FromDiscord | <Phil> It may need to be in the path, I'm currently looking where I put it |
21:41:08 | FromDiscord | <0x454d505459> is it looking for `/usr/lib/qt/plugins/styles/libqgtk2style.so` ? |
21:42:00 | FromDiscord | <Phil> pretty sure not under that path as at least I don't have that under there |
21:42:11 | FromDiscord | <0x454d505459> gonna link it in /lib ig |
21:42:56 | FromDiscord | <0x454d505459> didn't work |
21:43:06 | FromDiscord | <Phil> Well I have `/lib/gtk-2.0`, I don't recall that being the thing that did it |
21:43:32 | FromDiscord | <Phil> same for lib64 |
21:43:53 | FromDiscord | <0x454d505459> lib64 is just a symlink to /lib I think |
21:44:14 | FromDiscord | <0x454d505459> In reply to @Isofruit "Well I have `/lib/gtk-2.0`,": I have that directory too |
21:44:18 | FromDiscord | <Phil> You have libdotherside somewhere in your path as well? |
21:44:23 | FromDiscord | <0x454d505459> yes |
21:44:48 | FromDiscord | <0x454d505459> `/usr/local/lib/libDOtherSide.so.0.9.0` here |
21:45:01 | FromDiscord | <0x454d505459> linked in `/usr/lib` |
21:47:32 | FromDiscord | <0x454d505459> can't find anything on google |
21:48:45 | FromDiscord | <Phil> Past me had some really damn good google fu, let me search a bit more |
21:49:56 | FromDiscord | <0x454d505459> sure |
21:51:32 | FromDiscord | <0x454d505459> someone had the same issue with "Viber" but didn't found anythign |
21:51:35 | FromDiscord | <0x454d505459> (edit) "anythign" => "anything" |
21:51:48 | FromDiscord | <auxym> In reply to @albassort "cant you statically link": statically link it with what? The nim compiler? compile-time code (nim vm) runs before linking... |
21:54:36 | FromDiscord | <0x454d505459> In reply to @0x454d505459 "someone had the same": Gonna take a sleep, maybe i'll found answers tomorrow, thanks for the help @Phil |
21:54:55 | FromDiscord | <Phil> In reply to @0x454d505459 "Gonna take a sleep,": For what little I could recall, sorry =/ |
21:56:41 | FromDiscord | <Phil> sent a long message, see http://ix.io/4iXF |
21:56:54 | FromDiscord | <Phil> (edit) "http://ix.io/4iXF" => "http://ix.io/4iXG" |
21:57:15 | FromDiscord | <albassort> is there anyway to turn off const declarations on compile and make them let |
21:57:21 | FromDiscord | <albassort> or at least do this for nimsuggest |
21:57:45 | FromDiscord | <albassort> because const makes projects very slow to respond |
22:05:56 | FromDiscord | <Phil> In reply to @0x454d505459 "Gonna take a sleep,": May be of interest to you but I do also have this nimble package installed:↵https://github.com/nim-lang/gtk2↵↵I am uncertain as to whether that's the major difference |
22:06:12 | * | genpaku quit (Read error: Connection reset by peer) |
22:08:42 | * | genpaku joined #nim |
22:33:47 | FromDiscord | <ajusa> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4iIi <@10289981314985": Thanks once again for writing this down beef, I've updated my code to use something based off of it.↵fixing the few issues required me to understand macros, after nearly three years of avoiding them. |
22:42:44 | * | adium quit (Ping timeout: 272 seconds) |
22:46:05 | * | adium joined #nim |
22:54:06 | FromDiscord | <Elegantbeef> @ajusa\: macros really arent as scary as they let on 😄 |
22:59:23 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iXV |
22:59:38 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4iXV" => "https://play.nim-lang.org/#ix=4iXW" |
22:59:47 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4iXW" => "https://play.nim-lang.org/#ix=4iXX" |
23:00:04 | FromDiscord | <albassort> @ElegantBeef do you like how i implemented a serialized bitfield |
23:00:40 | FromDiscord | <Elegantbeef> Message is invisible here sadly |
23:01:05 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4iXX |
23:01:43 | FromDiscord | <Elegantbeef> Was `cast[uint8](a)` too difficult? |
23:02:04 | FromDiscord | <albassort> how... |
23:02:06 | FromDiscord | <albassort> what |
23:02:15 | FromDiscord | <Elegantbeef> What? |
23:02:20 | FromDiscord | <albassort> how would that work |
23:02:28 | FromDiscord | <Elegantbeef> `set[Number]` with 4 entries is the size of 8 bits |
23:02:45 | FromDiscord | <Elegantbeef> `cast[uint8](mySet)` will give you the uint8 of that bitset |
23:05:09 | FromDiscord | <Elegantbeef> @guzba\: i couldnt help myself to make a less allocating version of your URI parser that works on devel only 😄 |
23:05:11 | FromDiscord | <Elegantbeef> https://github.com/beef331/webby/blob/master/src/webby.nim |
23:05:52 | FromDiscord | <Elegantbeef> It |
23:05:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4iY0 |
23:06:18 | FromDiscord | <Elegantbeef> Ah nvm it is |
23:06:28 | FromDiscord | <Elegantbeef> Misread it earlier |
23:07:17 | FromDiscord | <albassort> i hate that your solution works |
23:07:39 | FromDiscord | <Elegantbeef> I mean that's what cast is for |
23:08:48 | FromDiscord | <albassort> deducing complex types to integers? |
23:08:57 | FromDiscord | <albassort> (edit) "deducing" => "reducing" |
23:09:04 | FromDiscord | <Elegantbeef> Reinterpreting a data into other data |
23:09:33 | FromDiscord | <albassort> I guess i never thought of it for this usecase because you are guaranteed to know the size |
23:09:37 | FromDiscord | <Elegantbeef> `set[Number]` is just a bitset which is a high level abstraction over `1 or 2 or 4 or 8 ...` |
23:10:01 | FromDiscord | <albassort> (edit) "I guess i never thought of it for this usecase because you are ... guaranteedusually" added "not" | "notguaranteed to know the size ... " added "usually" |
23:10:20 | FromDiscord | <albassort> i wonder if i can cast this massive sequence to an int |
23:10:32 | FromDiscord | <Elegantbeef> Internally it's just either a uint8 or a an `array[size, uint8]` |
23:11:30 | FromDiscord | <albassort> oh only certain types of fixed size can be cast to integers |
23:11:58 | FromDiscord | <Elegantbeef> I mean technically you can cast anything to anything if Nim says so |
23:12:17 | FromDiscord | <Elegantbeef> But it's an 'unsafe' operation that you should only do if you know what you're doing |
23:18:21 | * | ltriant joined #nim |
23:53:33 | arkanoid | is it possible to call fieldPairs on a "ptr Foo" ? I've tried with fieldPairs(foo) and fieldPairs(foo[]) but in both cases in wont compile |
23:54:27 | FromDiscord | <Elegantbeef> The latter should work if it's not an object variant |
23:56:26 | FromDiscord | <guzba> In reply to @Elegantbeef "<@318284269908918273>\: i couldnt help": ah works on on devel is a bummer. without having looked closely yet could the same ideas work without devel or is it critical? |
23:56:47 | FromDiscord | <guzba> less allocations is never a bad thing |
23:56:53 | arkanoid | mmm, if you say so, I'll dig deeper |
23:57:26 | FromDiscord | <Elegantbeef> Replace all `toOpenArray` with the string variants of `parseX` and yea it works with standard |
23:59:40 | FromDiscord | <Elegantbeef> The `openarray[char]` variants in devel are just nicer since they actually move the start of the `openarray[char]` up instead of make you think about the entire string |