00:00:11 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:34 | * | tk joined #nim |
00:05:02 | arkanoid | what's the actual difference from an inline function and a template? |
00:05:25 | arkanoid | apart from the fact that one is metaprogramming and the other is not |
00:06:42 | FromDiscord | <ynfle (ynfle)> inline isn't enforced |
00:06:46 | FromDiscord | <ynfle (ynfle)> It's a suggestion to the c compiler |
00:06:57 | FromDiscord | <ynfle (ynfle)> Template is computed by the VM at compile time |
00:07:25 | FromDiscord | <ynfle (ynfle)> You can have things like `when` blocks that change the generated c code and don't have the cost of `if` statments |
00:07:56 | FromDiscord | <ynfle (ynfle)> Template can also use the the surrounding non-global context because they are computed at compile time |
00:13:23 | * | krux02 quit (Quit: Leaving) |
00:28:04 | * | Colt quit (Remote host closed the connection) |
00:28:38 | FromDiscord | <Elegantbeef> Ynfle the same can be said about procs and `when` |
00:28:45 | * | Colt joined #nim |
00:29:25 | FromDiscord | <Fish-Face> is there a built in iterator (or function producing sequences to iterate over) which will count either up or down |
00:29:35 | FromDiscord | <Elegantbeef> Procs can have when thanks to generics and are also handled similarly to templates, and actually templates arent really computed by the VM |
00:29:43 | FromDiscord | <Elegantbeef> you mean `for x in 0..10`? |
00:29:56 | FromDiscord | <Fish-Face> if that worked with `10..0` then yes |
00:29:58 | FromDiscord | <Elegantbeef> or `for x in countUp(0, 10)` `for x in countDown(10, 0)`? |
00:30:16 | FromDiscord | <Elegantbeef> Ah aoc day 5? |
00:30:21 | FromDiscord | <Fish-Face> 😉 |
00:30:35 | FromDiscord | <Elegantbeef> `for x in min(a, b)..max(a, b)` |
00:30:48 | FromDiscord | <Fish-Face> hmph |
00:31:33 | FromDiscord | <Fish-Face> It's not that I can only solve it like that it's just I like to do things in a certain way as a way to explore the language 😛 |
00:33:20 | FromDiscord | <Elegantbeef> Hey it's how i solved it |
00:33:28 | FromDiscord | <Elegantbeef> And my solution is fastish |
00:35:40 | FromDiscord | <Fish-Face> ah I was meaning - even if presented with a perfectly reasonable alternative solution doesn't mean I want to use it 🙂 |
00:36:41 | * | rockcavera quit (Remote host closed the connection) |
00:39:02 | FromDiscord | <retkid> In reply to @Elegantbeef "`var a = create(int,": having trouble assigning a var to this |
00:40:05 | FromDiscord | <retkid> wait im thinking about this wrong |
00:43:33 | FromDiscord | <retkid> so i can make it its own unique datatype and assign it to a method |
00:43:40 | FromDiscord | <retkid> but i cant assign data itself to it? |
00:44:22 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H8V |
00:44:40 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3H8V" => "https://play.nim-lang.org/#ix=3H8W" |
00:44:58 | FromDiscord | <retkid> i mean it works, but for one var thats kinda ugly |
00:45:11 | FromDiscord | <retkid> though i do kinda like it so i can organize a lot of data in this type |
00:50:19 | FromDiscord | <Elegantbeef> I dont know what you mean |
01:07:19 | arkanoid | do you know where I can reach Mr Stefan Salewski? |
01:10:04 | * | rockcavera joined #nim |
01:10:04 | * | rockcavera quit (Changing host) |
01:10:04 | * | rockcavera joined #nim |
01:10:46 | arkanoid | or you know if there's anything that make bindings from gobject introspection? |
01:11:05 | arkanoid | I know about gintro but seems tightly coupled with gtk |
01:13:24 | FromDiscord | <ynfle (ynfle)> @beef by computer I meant expanded and inlined. Not like static computation |
01:13:45 | FromDiscord | <ynfle (ynfle)> \compute |
01:14:26 | FromDiscord | <retkid> In reply to @Elegantbeef "I dont know what": As opposed to just doing ↵x= create(int 300)↵x= 1 |
01:18:57 | arkanoid | ynfle. I forgot to thank you for the answer. I got the difference |
01:25:02 | FromDiscord | <Rika> In reply to @retkid "As opposed to just": What? I still don’t understand the idea |
01:28:21 | * | src quit (Quit: Leaving) |
01:28:56 | FromDiscord | <ynfle (ynfle)> rika, template vs. inlne? |
01:31:52 | NimEventer | New question by Zecong Hu: Implementing map & min that takes the tables.keys iterator as argument in Nim, see https://stackoverflow.com/questions/70240040/implementing-map-min-that-takes-the-tables-keys-iterator-as-argument-in-nim |
01:32:11 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H92 |
01:32:38 | FromDiscord | <Rika> Well yes, an object is not it’s field |
01:32:54 | FromDiscord | <retkid> so you can only assign vars to fields in a shared object? |
01:32:58 | FromDiscord | <Rika> Oh wait no i misread |
01:33:06 | FromDiscord | <retkid> (edit) "shared object?" => "ptr?" |
01:33:09 | FromDiscord | <Rika> Okay you can do this with [] after the variable name |
01:33:17 | FromDiscord | <Rika> To dereference |
01:33:27 | FromDiscord | <retkid> bella, thank you |
01:33:30 | FromDiscord | <Elegantbeef> with a field access the compiler knows to deference automagically, with a integer it doesnt |
01:33:56 | FromDiscord | <Rika> It technically could |
01:34:01 | FromDiscord | <Elegantbeef> you will most likely want to do `cast[ptr array[200, int]](createShared(int, 200))` for the proper logic |
01:34:11 | FromDiscord | <Elegantbeef> I mean yes it could if you did `ptr T = T` |
01:37:19 | FromDiscord | <retkid> 1 extra thing |
01:37:42 | FromDiscord | <retkid> what happens if the var exceeded the bytes assigned to it? |
01:38:19 | FromDiscord | <Rika> Undefined behaviour |
01:38:29 | FromDiscord | <Rika> Most likely a segmentation fault |
01:38:48 | FromDiscord | <retkid> is there anyway to manage this? |
01:38:58 | FromDiscord | <retkid> well |
01:39:03 | FromDiscord | <retkid> i suppose the answer is yes |
01:39:14 | FromDiscord | <retkid> but whats an efficient way to manage this? |
01:39:34 | FromDiscord | <retkid> try excepts wont work for the resize? |
01:39:45 | FromDiscord | <retkid> (edit) "resize?" => "resize if its a segfault ?" |
01:40:34 | FromDiscord | <Rika> Track the size |
01:40:40 | FromDiscord | <Rika> And manually handle it |
01:40:54 | FromDiscord | <retkid> yea i should just make a thread that just watched it |
01:41:05 | FromDiscord | <Rika> Ah this is threaded |
01:41:12 | FromDiscord | <Rika> Hmm it might be a bit hard then |
01:41:27 | FromDiscord | <Rika> Are you aiming for lock free? |
01:41:31 | FromDiscord | <retkid> yea, where do i put the code that just watches it |
01:41:43 | FromDiscord | <retkid> In reply to @Rika "Are you aiming for": locks make things complicated, ideally yes |
01:42:05 | FromDiscord | <Rika> Lock free makes it more complicated I would say , just an FYI |
01:42:22 | FromDiscord | <Elegantbeef> If you're mutating from threads this you pretty much need a lock |
01:42:50 | FromDiscord | <Rika> ??? Really |
01:42:55 | FromDiscord | <retkid> i dont see why i would |
01:43:33 | FromDiscord | <retkid> its on shared heap, so you just add to it. the problem would arise when i cant catch it being too close to the limit |
01:43:40 | FromDiscord | <Rika> I mean for basic stuff you should use locks since it is just simpler and easier |
01:44:02 | FromDiscord | <retkid> which i guess is a race condiitoon \ |
01:44:05 | FromDiscord | <retkid> (edit) "condiitoon \" => "condition" |
01:44:10 | FromDiscord | <Elegantbeef> I mean if multiple threads are mutating a collection, without locks you're going to get so many race conditions if you dont design it to accomidate |
01:44:26 | FromDiscord | <Rika> If one of two threads does an add and another thread does a delete before the add then you either don’t delete or don’t add because the threads trampled over each other |
01:44:39 | FromDiscord | <Rika> So you have to use some sort of synchronisation method |
01:45:07 | FromDiscord | <retkid> it would be add only |
01:45:20 | FromDiscord | <retkid> managing deleting and adding is too much of a nightmare |
01:45:27 | FromDiscord | <Rika> Even if it is add only |
01:45:32 | FromDiscord | <Elegantbeef> There is the even more worrisome thing of iterating over on one thread whilst another one adds and moves the data cause you went over the length and reallocated |
01:45:38 | FromDiscord | <Rika> If two threads add at the same time one add will be lost |
01:45:48 | FromDiscord | <retkid> nothing iterates over it i dont think |
01:46:00 | FromDiscord | <retkid> In reply to @Elegantbeef "There is the even": i also have a iterator for this |
01:46:05 | FromDiscord | <retkid> (edit) "a" => "an" |
01:46:24 | FromDiscord | <Elegantbeef> I mean if you're adding whilst accessing you have an issue |
01:46:32 | FromDiscord | <Elegantbeef> iterating was just a long operation |
01:46:32 | FromDiscord | <retkid> ah |
01:46:35 | FromDiscord | <Rika> An iterator would need a lock or a copy of the data so it doesn’t change |
01:46:55 | FromDiscord | <retkid> think i posted this guy here before |
01:47:02 | FromDiscord | <retkid> this guy is recursive |
01:47:04 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H93 |
01:47:07 | FromDiscord | <retkid> dont think it works for this though |
01:47:16 | FromDiscord | <retkid> (edit) |
01:47:44 | FromDiscord | <retkid> i used to have a sleep in there idk where it went |
01:48:01 | FromDiscord | <Rika> Still if something changes then you probably just yielded malformed data |
01:48:32 | FromDiscord | <Elegantbeef> The only time you can do lockfree stuff is if your algorithm or design prevents race conditions |
01:48:51 | FromDiscord | <Rika> Yeah of course |
01:49:04 | FromDiscord | <Elegantbeef> For instance if you're only adding you could have the last bit of data be a pointer to another chunk and have a large linked list |
01:49:13 | FromDiscord | <retkid> i could make it read the ptr every 5 seconds |
01:49:20 | FromDiscord | <retkid> so it always has a seperate state |
01:49:22 | FromDiscord | <retkid> (edit) "seperate" => "separate" |
01:50:00 | FromDiscord | <Elegantbeef> If you only grow then you never have any race conditions if this is never mutated aside from that |
01:50:30 | FromDiscord | <Elegantbeef> With my example of course |
01:51:19 | FromDiscord | <retkid> so you mean the last entry in the sequence is a pointer |
01:51:30 | FromDiscord | <retkid> and you insert to 1 before that? |
01:51:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3H95 |
01:51:36 | FromDiscord | <Rika> Only adding still has race conditions |
01:51:57 | FromDiscord | <Elegantbeef> You lock the pointer when adding of course |
01:52:07 | FromDiscord | <Elegantbeef> but that gives you a much smaller lock foot print |
01:52:14 | FromDiscord | <retkid> echo seqence[sequence.len()-1] changes as its done |
01:52:16 | FromDiscord | <Rika> It’s still a lock |
01:52:28 | FromDiscord | <retkid> (edit) "done" => "operated" |
01:52:32 | FromDiscord | <Elegantbeef> Of course |
02:19:09 | arkanoid | I'm trying to install futhark but I keep getting "/usr/bin/ld: cannot find -lclang" |
02:19:27 | arkanoid | I'm trying with "nimble install --passl:-L/usr/lib/llvm-10/lib futhark" |
02:19:43 | arkanoid | lib is in /usr/lib/llvm-10/lib/libclang.so.1 |
02:20:57 | arkanoid | complete error is: https://play.nim-lang.org/#ix=3H9a |
02:21:07 | arkanoid | it seems to me that -l and -L args are in wrong order |
02:21:54 | arkanoid | shoudn't -L<path> come before -lclang ? |
02:25:11 | * | neurocyte0132889 quit (Ping timeout: 252 seconds) |
02:29:18 | arkanoid | oh dear, I had to manually create symlink, just like here https://github.com/lvzixun/Clang-Complete/issues/49 |
02:46:26 | FromDiscord | <Delta> does nim have any unit testing tools/libs that support test caching? |
02:52:48 | * | arkurious quit (Quit: Leaving) |
03:01:04 | FromDiscord | <TryAngle> In reply to @Delta "does nim have any": Haven't tried it but can't u define global variables and just use them in the tests? |
03:06:47 | * | sagax joined #nim |
03:42:43 | arkanoid | Delta, what is test caching? |
03:43:23 | FromDiscord | <Delta> If you've ever used `go test`, it can cache the results of unit tests that refer to unchanged code |
03:43:58 | FromDiscord | <Delta> so if I have 4000 unit tests, but I've only changed one package only the N tests that refer to code in that package get re-run when I run `go test` again |
03:46:00 | * | rockcavera quit (Remote host closed the connection) |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
05:06:14 | * | noeontheend quit (Remote host closed the connection) |
05:17:32 | NimEventer | New post on r/nim by smazga: Dynamic proc calling, see https://reddit.com/r/nim/comments/r9zew0/dynamic_proc_calling/ |
05:18:52 | * | noeontheend joined #nim |
05:26:28 | * | dom96 quit (*.net *.split) |
05:26:28 | * | ehmry quit (*.net *.split) |
05:26:28 | * | adium quit (*.net *.split) |
05:26:29 | * | supakeen quit (*.net *.split) |
05:26:29 | * | Colt quit (*.net *.split) |
05:26:29 | * | tk quit (*.net *.split) |
05:26:29 | * | tinystoat quit (*.net *.split) |
05:26:29 | * | pch quit (*.net *.split) |
05:26:30 | * | dv^_^ quit (*.net *.split) |
05:26:30 | * | oprypin quit (*.net *.split) |
05:26:30 | * | mal`` quit (*.net *.split) |
05:26:30 | * | arkanoid quit (*.net *.split) |
05:26:31 | * | [R] quit (*.net *.split) |
05:26:31 | * | mahlon quit (*.net *.split) |
05:26:31 | * | nrds quit (*.net *.split) |
05:26:31 | * | Zevv quit (*.net *.split) |
05:26:31 | * | Lord_Nightmare quit (*.net *.split) |
05:26:32 | * | def- quit (*.net *.split) |
05:26:32 | * | dtomato quit (*.net *.split) |
05:26:33 | * | joshbaptiste quit (*.net *.split) |
05:26:33 | * | robertmeta quit (*.net *.split) |
05:26:33 | * | rp2 quit (*.net *.split) |
05:26:34 | * | jkl1337 quit (*.net *.split) |
05:26:34 | * | blackbeard420 quit (*.net *.split) |
05:26:34 | * | GreaseMonkey quit (*.net *.split) |
05:26:34 | * | redj quit (*.net *.split) |
05:26:35 | * | crem quit (*.net *.split) |
05:26:35 | * | koltrast quit (*.net *.split) |
05:26:35 | * | happycorsair[m] quit (*.net *.split) |
05:26:36 | * | madprops quit (*.net *.split) |
05:26:36 | * | lain quit (*.net *.split) |
05:26:36 | * | qwr quit (*.net *.split) |
05:26:36 | * | djanatyn quit (*.net *.split) |
05:26:37 | * | mjsir911 quit (*.net *.split) |
05:26:37 | * | syl quit (*.net *.split) |
05:26:37 | * | cheer[m] quit (*.net *.split) |
05:26:37 | * | ormiret quit (*.net *.split) |
05:26:37 | * | ozzz quit (*.net *.split) |
05:26:37 | * | Yardanico quit (*.net *.split) |
05:26:37 | * | oddish quit (*.net *.split) |
05:26:37 | * | NimEventer quit (*.net *.split) |
05:26:39 | * | LyndsySimon quit (*.net *.split) |
05:26:39 | * | nixfreaknim[m] quit (*.net *.split) |
05:26:39 | * | meowray quit (*.net *.split) |
05:28:13 | * | supakeen joined #nim |
05:28:13 | * | Colt joined #nim |
05:28:13 | * | tk joined #nim |
05:28:13 | * | [R] joined #nim |
05:28:13 | * | tinystoat joined #nim |
05:28:13 | * | mahlon joined #nim |
05:28:13 | * | pch joined #nim |
05:28:13 | * | dtomato joined #nim |
05:28:13 | * | nrds joined #nim |
05:28:13 | * | Zevv joined #nim |
05:28:13 | * | dv^_^ joined #nim |
05:28:13 | * | oprypin joined #nim |
05:28:13 | * | mal`` joined #nim |
05:28:13 | * | arkanoid joined #nim |
05:28:13 | * | Lord_Nightmare joined #nim |
05:28:13 | * | happycorsair[m] joined #nim |
05:28:13 | * | def- joined #nim |
05:28:13 | * | mjsir911 joined #nim |
05:28:13 | * | syl joined #nim |
05:28:13 | * | dom96 joined #nim |
05:28:13 | * | ehmry joined #nim |
05:28:13 | * | adium joined #nim |
05:28:13 | * | cheer[m] joined #nim |
05:28:13 | * | ormiret joined #nim |
05:28:13 | * | madprops joined #nim |
05:28:13 | * | lain joined #nim |
05:28:13 | * | rp2 joined #nim |
05:28:13 | * | jkl1337 joined #nim |
05:28:13 | * | qwr joined #nim |
05:28:13 | * | ozzz joined #nim |
05:28:13 | * | blackbeard420 joined #nim |
05:28:13 | * | joshbaptiste joined #nim |
05:28:13 | * | robertmeta joined #nim |
05:28:13 | * | LyndsySimon joined #nim |
05:28:13 | * | GreaseMonkey joined #nim |
05:28:13 | * | crem joined #nim |
05:28:13 | * | nixfreaknim[m] joined #nim |
05:28:13 | * | redj joined #nim |
05:28:13 | * | Yardanico joined #nim |
05:28:13 | * | oddish joined #nim |
05:28:13 | * | koltrast joined #nim |
05:28:13 | * | djanatyn joined #nim |
05:28:13 | * | NimEventer joined #nim |
05:28:13 | * | meowray joined #nim |
05:30:16 | * | Colt quit (Remote host closed the connection) |
05:30:41 | * | Colt joined #nim |
05:37:33 | * | LyndsySimon quit (*.net *.split) |
05:37:33 | * | nixfreaknim[m] quit (*.net *.split) |
05:37:33 | * | meowray quit (*.net *.split) |
05:37:44 | * | LyndsySimon joined #nim |
05:37:44 | * | meowray joined #nim |
05:45:45 | * | nixfreaknim[m] joined #nim |
06:07:01 | * | noeontheend quit (Ping timeout: 252 seconds) |
06:55:35 | * | xet7 joined #nim |
07:12:26 | FromDiscord | <retkid> is there an async function to do something at an interval |
07:17:21 | FromDiscord | <Yardanico> https://nim-lang.org/docs/asyncdispatch.html#addTimer%2Cint%2Cbool%2CCallback or you can just write an async proc with a `while true` loop that does the stuff your want and then `sleepAsync(ms to sleep)` |
07:18:18 | FromDiscord | <retkid> In reply to @Yardanico "https://nim-lang.org/docs/asyncdispatch.html#addTim": well i want it to continue the code |
07:18:46 | FromDiscord | <Yardanico> ?? |
07:18:52 | FromDiscord | <Yardanico> it won't block your other async tasks |
07:19:02 | FromDiscord | <Yardanico> since it'll sleep with `sleepAsync` and not `sleep` |
07:19:13 | FromDiscord | <retkid> sorry my async ideas have been corrupted by JS |
07:20:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3H9N |
07:20:43 | FromDiscord | <Yardanico> just do like `doStuff` and call it from your main routine with `asyncCheck doStuff()` |
07:21:03 | FromDiscord | <Yardanico> asyncCheck is needed so that if doStuff throws an exception, it'll actually be caught and will stop program execution |
07:21:22 | FromDiscord | <Yardanico> you can of course also set the callback of the future manually if you want to do different stuff if the future fails with an exception |
07:33:29 | FromDiscord | <retkid> HEY |
07:33:31 | FromDiscord | <retkid> I did lockless |
07:34:03 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9Q |
07:34:08 | FromDiscord | <retkid> list = a[] removes the race condition |
07:34:35 | FromDiscord | <retkid> problem is there is no good gcc so it consumes too much ram so it just kinda hangs |
07:35:44 | FromDiscord | <retkid> ah nevermind getting segfaults? |
07:36:16 | FromDiscord | <Yardanico> ??? |
07:37:47 | * | PMunch joined #nim |
07:37:52 | FromDiscord | <retkid> oh it was a conversation from earlier |
07:41:01 | * | pch quit (Quit: Leaving) |
07:49:16 | FromDiscord | <retkid> fuck it, its lock time↵' |
07:49:17 | FromDiscord | <retkid> (edit) "time↵'" => "time" |
07:49:22 | FromDiscord | <retkid> (edit) removed "fuck it," |
07:51:48 | * | jjido joined #nim |
07:58:29 | FromDiscord | <n00nehere> hey |
07:58:48 | FromDiscord | <n00nehere> i am trying to use webview library of juancarlospaco |
07:58:58 | FromDiscord | <n00nehere> but when trying to use as html a variable i get the following error |
07:58:59 | FromDiscord | <n00nehere> first type mismatch at position\: 1↵ required type for path\: static[string]↵ but expression 'dataUriHtmlHeader' is of type\: string |
07:59:35 | FromDiscord | <Yardanico> well, the proc says it requires you to specify the string that is known at compile time |
07:59:39 | FromDiscord | <Yardanico> so you can't provide a runtime string to it |
07:59:43 | FromDiscord | <Yardanico> not `let` but `const` |
07:59:54 | FromDiscord | <Yardanico> did you see https://github.com/marcomq/nimview btw? |
08:00:01 | FromDiscord | <retkid> god |
08:00:02 | FromDiscord | <retkid> const |
08:00:08 | FromDiscord | <n00nehere> not yet↵(@Yardanico) |
08:00:12 | FromDiscord | <retkid> i forgot about const |
08:00:24 | FromDiscord | <n00nehere> yea it was a const the problem |
08:00:26 | FromDiscord | <n00nehere> i was using var |
08:00:33 | FromDiscord | <n00nehere> but looks like it fucking dies if i use var |
08:00:35 | FromDiscord | <retkid> thats fair |
08:00:44 | FromDiscord | <retkid> i've never had to use const |
08:00:45 | FromDiscord | <retkid> for anythiong |
08:00:47 | FromDiscord | <retkid> (edit) "anythiong" => "anything" |
08:00:52 | FromDiscord | <Yardanico> In reply to @n00nehere "but looks like it": it just shows an error, a pretty descriptive one if you know what `static` is |
08:00:53 | FromDiscord | <n00nehere> same↵(@retkid) |
08:01:01 | FromDiscord | <retkid> outside of JS |
08:01:02 | FromDiscord | <Yardanico> static[string] in a proc definition requires the string to be known at compile-time |
08:01:06 | FromDiscord | <n00nehere> never used const, idk |
08:01:07 | FromDiscord | <retkid> JS has a const fetish |
08:01:19 | FromDiscord | <n00nehere> js is weird in general↵(@retkid) |
08:01:21 | FromDiscord | <Yardanico> In reply to @retkid "JS has a const": because it has very different semantics from `const` in nim |
08:01:27 | FromDiscord | <Yardanico> nim IMO has one of the cleanest semantics for variable modifiers\ |
08:01:28 | FromDiscord | <Yardanico> (edit) "modifiers\" => "modifiers" |
08:01:32 | FromDiscord | <Yardanico> `var` - runtime, mutable |
08:01:39 | FromDiscord | <Yardanico> `let` - runtime, immutable (except ref) |
08:01:44 | FromDiscord | <Yardanico> `const` - compile-time, immutable |
08:01:58 | FromDiscord | <Yardanico> modifiers don't affect the scope because in nim it's always the local scope |
08:02:19 | FromDiscord | <retkid> i don't really like : as a type declaration |
08:02:20 | FromDiscord | <Yardanico> we do have `{.global.}` pragma for declaring global variables inside of procedures, but it's a bit buggy |
08:02:21 | FromDiscord | <retkid> prefer kotlins |
08:02:29 | FromDiscord | <Yardanico> In reply to @retkid "i don't really like": you don't need it in most cases |
08:02:35 | FromDiscord | <Yardanico> i mean for variables |
08:02:49 | FromDiscord | <retkid> not kotlins, kotlin has the same |
08:02:49 | FromDiscord | <n00nehere> well nimview is still alive i see↵(@Yardanico) |
08:02:52 | FromDiscord | <retkid> except its like |
08:03:16 | FromDiscord | <retkid> i like javas |
08:03:17 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9V |
08:03:26 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9W |
08:03:33 | FromDiscord | <Yardanico> well, in nim for these cases you can just do `var x = 328` |
08:03:47 | FromDiscord | <retkid> yea but you do |
08:03:48 | FromDiscord | <n00nehere> guess i will rewrite everything to use it |
08:03:54 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
08:04:12 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/Uf1 |
08:04:13 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=3H9Y" => "https://play.nim-lang.org/#ix=3H9Z" |
08:04:22 | FromDiscord | <retkid> but it doesn't |
08:04:23 | FromDiscord | <Yardanico> since you "don't like the type" |
08:04:24 | FromDiscord | <retkid> java is insane |
08:04:25 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Ha0 |
08:04:31 | FromDiscord | <Yardanico> (edit) "type"" => "syntax"" |
08:04:34 | FromDiscord | <retkid> (edit) |
08:04:40 | FromDiscord | <retkid> i forget how to make a list off the top of my head in java |
08:04:45 | FromDiscord | <retkid> its stupid |
08:05:09 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3Ha0" => "https://play.nim-lang.org/#ix=3Ha1" |
08:05:10 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3Ha1" => "https://play.nim-lang.org/#ix=3Ha0" |
08:05:16 | FromDiscord | <Solitude> how do i unsubscribe from your blog? |
08:05:28 | FromDiscord | <retkid> you dont :") |
08:05:38 | FromDiscord | <Yardanico> we can go to #offtopic to discuss this really |
08:05:45 | FromDiscord | <Yardanico> a much better place :) |
08:11:12 | * | pch joined #nim |
08:18:17 | FromDiscord | <tbrekalo> https://play.nim-lang.org/#ix=3Ha7↵↵can I generate a random name for the `cy000cle` variable in this code snippet? |
08:19:07 | FromDiscord | <Yardanico> it's already "random" because nim templates are hygienic by default |
08:19:23 | FromDiscord | <Yardanico> you won't be able to access "cy000cle" from the code `repeatBlock(2): code` |
08:19:29 | FromDiscord | <Elegantbeef> For instance |
08:19:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ha8 |
08:19:38 | FromDiscord | <Elegantbeef> It errors as yardanico pointed out |
08:20:02 | FromDiscord | <Yardanico> you can also make it `for _ in 0 ..< n` too if you don't like having a "real" variable name there :) |
08:20:17 | FromDiscord | <Elegantbeef> if you do want to inject symbols you need to do `{.dirty.}` on the template or `for it {.inject.} 0 ..<n:` |
08:20:21 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates |
08:20:23 | FromDiscord | <tbrekalo> so I can't access `it` inside the `body` ? |
08:20:26 | FromDiscord | <Yardanico> yes |
08:20:30 | FromDiscord | <Yardanico> "Per default, templates are hygienic: Local identifiers declared in a template cannot be accessed in the instantiation context:" |
08:20:45 | FromDiscord | <tbrekalo> thanks! 🙂 |
08:21:08 | FromDiscord | <tbrekalo> Before I had some love hate towards nim; starting to love it doing AoC |
08:26:13 | * | pro joined #nim |
08:29:00 | * | pro quit (Client Quit) |
08:29:50 | * | pro joined #nim |
11:21:33 | NimEventer | New thread by Devosalain2: Kate editor & lsp server, see https://forum.nim-lang.org/t/8682 |
11:23:02 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:43:52 | * | src joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:10:44 | PMunch | @tbrekalo, cool that you're starting to love Nim. Was there anything in particular with AoC that caused you to like Nim more? |
13:02:08 | * | kayabaNerve_ joined #nim |
13:02:44 | FromDiscord | <Zoom> This messes the direction, so it won't work for parallel iteration. |
13:04:39 | * | kayabaNerve quit (Ping timeout: 252 seconds) |
13:10:35 | * | jjido joined #nim |
13:14:22 | * | filcuc_ joined #nim |
13:16:20 | * | filcuc_ quit (Client Quit) |
13:38:00 | * | rockcavera joined #nim |
13:38:00 | * | rockcavera quit (Changing host) |
13:38:00 | * | rockcavera joined #nim |
14:08:05 | FromDiscord | <Schelz> is there any way to use a nim code that is compiling with cpp arg in another code that compile with c arg ? |
14:08:51 | FromDiscord | <Schelz> cause i use in a script a module that compile with cpp only and another that compile with c and i want to combine them but when i do that one of them crash |
14:14:56 | PMunch | C should be able to be integrated in C++ fairly easily I believe |
14:15:11 | PMunch | Otherwise you'd probably have to build libraries and link them together |
14:28:31 | * | arkurious joined #nim |
14:35:00 | FromDiscord | <Schelz> the only problem i have is with nimgl imgui when i try to compile it with C i get the error "could not load: cimgui.dll" but if i compile with cpp i dont get any error |
14:35:20 | FromDiscord | <Schelz> so i could tweak it if i resolve "cimgui.dll" |
14:35:28 | FromDiscord | <Schelz> any idea how to solve ? |
14:37:10 | * | Vladar joined #nim |
14:38:22 | FromDiscord | <Yardanico> In reply to @Schelz "the only problem i": that's because if you compile with the C backend it uses cimgui.so dynamically |
14:38:28 | FromDiscord | <Yardanico> and with C++ backend it uses imgui itself |
14:38:58 | FromDiscord | <Schelz> so i could compile it with C right ? |
14:39:38 | FromDiscord | <Yardanico> yes but you'll need to use cimgui.so |
14:39:50 | FromDiscord | <Yardanico> you can also statically link but it's a bit weird with cimgui as it's not meant to be used with static linking with C |
14:40:01 | FromDiscord | <Yardanico> why not just use c++ backend for everything? |
14:40:31 | FromDiscord | <Schelz> cause i use C in the main code for a subhook and it working only with C |
14:41:19 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Hc7 |
14:42:01 | FromDiscord | <Rika> Afaik the discriminant must be 0 because of defaults |
14:42:09 | FromDiscord | <Rika> So I believe not |
14:42:36 | FromDiscord | <Schelz> @Yardanico do you have the cimgui.dll or do you know where can i get it from ? |
14:42:49 | FromDiscord | <Rika> In reply to @Rika "Afaik the discriminant must": example, what happens when `var a: Ob`? what would the value of a be? |
14:43:26 | FromDiscord | <haxscramper> Just like any `enum` with offset |
14:43:27 | FromDiscord | <haxscramper> broken value |
14:43:36 | FromDiscord | <Yardanico> In reply to @Schelz "<@!177365113899057152> do you have": you have to compile it yourself :() |
14:43:49 | FromDiscord | <Yardanico> sorry, can't help now, i'm a bit busy |
14:43:50 | FromDiscord | <Rika> and broken object definition? |
14:44:05 | FromDiscord | <Schelz> ok thanks for tip |
14:44:05 | FromDiscord | <Rika> enum value being 0 and broken is "fine" |
14:44:09 | FromDiscord | <haxscramper> yes, we don't have valid defaults so I would at least expect this to be possible |
14:44:55 | FromDiscord | <Rika> well it isnt because its not "everything is broken" its just "some things are broken and some things are correct" |
14:45:07 | FromDiscord | <Rika> you could say its worse yes |
14:45:14 | PMunch | Hmm, anyone else tried the Pizza Slicing Google doodle for today? |
14:45:52 | FromDiscord | <Rika> no i dont use google |
14:46:37 | FromDiscord | <haxscramper> Damn, it invites some really ugly code otherwise, without ranges |
14:47:31 | FromDiscord | <Rika> yeah i really cant wait for better default |
14:55:11 | arkanoid | PMunch: thanks for the answer on futhark. I'm again on same test currently. I really like futhark approach, I've achieved with it what took me days in c2nim |
14:56:31 | PMunch | I achieved in minutes (not counting the time I spent on actually writing Futhark) what I failed to do in a week at work.. |
14:58:56 | PMunch | I'm about to head home now. But if you see me online don't hesitate to ask about how to use it :) |
14:59:29 | arkanoid | well, I'm still trying to make GARROW_ARRAY_BUILDER work |
14:59:44 | PMunch | Are you still importing the cache file directly? |
15:00:12 | PMunch | The importc macro should automatically rebuild or simply resolve to import that file |
15:00:17 | PMunch | So you shouldn't import it manually |
15:00:30 | arkanoid | yep, is there a difference once the .json and .nim file have been built? |
15:01:05 | arkanoid | I did that just to have autocompletion in editor, but yes actually is not what you wrote in the example |
15:01:11 | arkanoid | let me rever it |
15:04:10 | arkanoid | I have the same problem without importing cache direction but coding straight below importc block |
15:04:19 | arkanoid | s/direction/directly |
15:06:16 | PMunch | Yeah I don't think that's related to your error |
15:06:33 | arkanoid | output on futhark/opir says "Hint: Renaming "GARROW_ARRAY_BUILDER" to "Garrowarraybuilderproc" [User]" |
15:07:19 | PMunch | That means that there exists something called Garrowarraybuilder already |
15:07:51 | PMunch | I assume that is "GArrowArrayBuilder" |
15:08:48 | PMunch | Okay, gotta go |
15:08:55 | PMunch | I'll have a look at this later |
15:09:05 | * | PMunch quit (Quit: Leaving) |
15:10:03 | arkanoid | sure, thanks, In the meanwhile I've pasted the complete output of futhark run with cache cleared |
15:23:31 | FromDiscord | <haxscramper> Roadmap has "Support field = defaultValue inside object declarations." so I suppose it is a known target at least↵(@Rika) |
15:33:57 | * | tiorock joined #nim |
15:33:57 | * | tiorock quit (Changing host) |
15:33:57 | * | tiorock joined #nim |
15:33:57 | * | rockcavera is now known as Guest6718 |
15:33:57 | * | Guest6718 quit (Killed (zinc.libera.chat (Nickname regained by services))) |
15:33:57 | * | tiorock is now known as rockcavera |
15:43:02 | * | tiorock joined #nim |
15:43:02 | * | tiorock quit (Changing host) |
15:43:02 | * | tiorock joined #nim |
15:43:02 | * | rockcavera quit (Killed (zirconium.libera.chat (Nickname regained by services))) |
15:43:02 | * | tiorock is now known as rockcavera |
15:50:13 | * | noeontheend joined #nim |
15:54:03 | FromDiscord | <n00nehere> how do i convert something to a string? |
15:54:59 | FromDiscord | <Yardanico> $ |
15:55:07 | FromDiscord | <n00nehere> thanks |
15:56:05 | noeontheend | If you need to define it yourself, then you can write your own "proc `$`(self: T): string" |
15:57:13 | noeontheend | `proc \`$\`(self: T): string` <- does that work? |
15:57:35 | noeontheend | Nope. Anyways, the $ is wrapped in backticks to show that it's an operator. |
15:57:36 | FromDiscord | <Yardanico> yes |
15:57:46 | FromDiscord | <Yardanico> ah you meant if it will be displayed fine on discord |
15:58:18 | noeontheend | :) |
16:16:00 | * | Pyautogui joined #nim |
16:17:11 | * | Pyautogui quit (Client Quit) |
16:26:44 | * | pro quit (Quit: WeeChat 3.3) |
16:39:01 | * | noeontheend quit (Ping timeout: 240 seconds) |
16:59:37 | * | PMunch joined #nim |
17:01:55 | PMunch | arkanoid, I'm trying to install arrow-glib so I can test myself but I get an error while building it |
17:02:24 | arkanoid | PMunch: wait, you got me in the moment I've just succeeded in building and executing the example! I'm updating the issue |
17:02:26 | PMunch | http://ix.io/3Hd0 |
17:02:33 | PMunch | Oh nice! |
17:03:00 | PMunch | I thought it might be that you simply didn't link to the sources, but I might be mistaken |
17:04:36 | arkanoid | PMunch: no, it's something about macro not binded correctly |
17:05:17 | PMunch | Ah right, yeah macros are a bit of a pain |
17:05:55 | arkanoid | I'm currently using the libarrow binary packages for ubuntu 20.04, so I can't say much about building locally. Let me get the tarball and try myself |
17:06:41 | PMunch | I was just trying to install it via pakku |
17:06:57 | arkanoid | don't know pakku, sounds new to me, let me google |
17:07:16 | PMunch | It's an alternative to yaourt |
17:07:22 | PMunch | Arch package manager |
17:07:46 | PMunch | Ah, the package is flagged as out of date |
17:07:59 | arkanoid | oh! archlinux. Long time no see |
17:11:35 | arkanoid | btw, to sum up the experience: 1) had to create symlink to libclang.so manually at futhark install as it was not getting libclang.so.1 of my ubuntu box (apt get install clang) 2) including headers is kinda misleading, as you said in the github issue, but once I got how it works it let's you import only what you need, but this makes futhark not a turnkey solution 3) had to deal with this missing |
17:11:38 | arkanoid | conversion of macros 4) why use .cache/nim? this kills autocompletion and stuff |
17:13:09 | arkanoid | but at the end, it worked way faster than c2nim and the .json and I ended up with nim code quite similar to C, ready to be wrapped |
17:19:50 | PMunch | 1) Hmm that sounds like a Ubuntu issue TBH.. Not really sure how I can work around this in Futhark. 2) This is something I want to rework, as I mentioned in the issue maybe a folder based solution? 3) Macros are really tricky, and the support for them in Futhark was about the last added and therefore least battle-tested part of it. 4) Not sure what you mean? I cache the results because otherwise it is super slow. And autocomplete works for me when using |
17:19:50 | PMunch | Futhark, albeit I have to build it once first before I open my editor (I believe nimsuggest runs into the maxVMIterations limit and stops before it is able to build anything. |
17:20:23 | * | krux02 joined #nim |
17:22:45 | PMunch | The good thing with Futhark is that once you know the things you've now learnt it is even faster wrapping your next library. It's still a bit finicky, but I've now wrapped and used a couple different C libraries and they all "just work". For comparison I've never been able to wrap anything with c2nim, and the times I've tried it's always ended up with having to massively rewrite the C sources in order for anything to work. |
17:24:23 | PMunch | I have a project where I use Futhark to wrap both X11 (the official wrapper didn't include all the stuff I needed) along with a bunch of scsi/ioctl stuff that isn't included in the posix wrapper. And it all just works |
17:24:52 | PMunch | I was able to import X11 to a level that's better than the published wrappers in a matter of minutes |
17:25:02 | arkanoid | PMunch: I also used a lot of c2nim and I like the approach, but it covers ihe initial 90% of the work in 1 minute and let's you cover the remaining 10% in time that depends on how large the lib is. It took me days of mangling and PEGs |
17:25:18 | PMunch | Exactly |
17:25:29 | PMunch | And then a new version of the library drops and you have to start over |
17:25:57 | PMunch | Or just assume your bindings work and have potential cryptic segfaults in your future |
17:26:24 | PMunch | (I was horrified at how far my manual wrapping of a C library we use at work had gotten when I compared it to the output of Futhark) |
17:26:38 | arkanoid | I tried to push whatever possible into name mangling rules |
17:26:41 | PMunch | I still worked, but that was probably more dumb luck than anything.. |
17:26:52 | arkanoid | I'm actually surprised how small is the source code of futhark |
17:27:03 | * | krux02 quit (Remote host closed the connection) |
17:27:05 | PMunch | I mean most of the heavy lifting is done by clang |
17:27:24 | * | krux02 joined #nim |
17:27:34 | arkanoid | this seems the right approach, why isn't this the default one? |
17:27:38 | PMunch | Opir just imports clang as a library and converts the clang datastructures to JSON, then all Futhark does is read that JSON file and generate Nim code |
17:27:47 | PMunch | It is the default one for me :P |
17:27:59 | FromDiscord | <haxscramper> With each discussion like this I remember the "the way c2nim does it is conceptionally the best way\:" and " I have used c2nim successfully, on thousand of lines of C++ code." |
17:28:12 | FromDiscord | <haxscramper> the libclang one? |
17:28:15 | arkanoid | I mean, I got it working without editing a single line of .h or .c, actually not ever the generated .nim but just overcome that macro problem (that's probably something fixable by futhark with some more work) |
17:28:47 | PMunch | The problem with macros is that they don't have types |
17:28:49 | FromDiscord | <haxscramper> Well, araq is convinced his hand-rolled C parser is robust enough |
17:28:52 | FromDiscord | <haxscramper> Who are we to argue |
17:29:23 | PMunch | Macros in C are just text substitution, so it's hard to reason about how to wrap them in Nim.. |
17:29:35 | FromDiscord | <n00nehere> hey, do someone here know how to use winim or winapi in general? |
17:29:37 | FromDiscord | <haxscramper> advancement in this field has always been an efforst of a singular person |
17:29:47 | FromDiscord | <haxscramper> shashlick, then I started it |
17:29:56 | FromDiscord | <n00nehere> i need to clear the clipboard content every hour but i can't manage to get the clipboard to work |
17:29:58 | FromDiscord | <haxscramper> then pmuch made futhark |
17:29:59 | PMunch | @haxscramper, well I mean it obviously isn't, when you look at how poorly c2nim works on even the simplest of macro-based code |
17:30:17 | arkanoid | I had partial success with c2nim, and I've wrapped a whole SOAP library of 60K loc, so it works, but the futhark approach seems more reliable to me |
17:30:19 | FromDiscord | <n00nehere> if i open the clipboard and try to read or delete the content i just get a 0 |
17:30:20 | FromDiscord | <haxscramper> futhark works great, hcparse at this stage is mostly an R&D project |
17:30:28 | FromDiscord | <haxscramper> it is too complex to give meaningful timeframes |
17:30:42 | FromDiscord | <haxscramper> Well, the problem formulation is much more complicated |
17:31:05 | FromDiscord | <haxscramper> But futhark is a great solution, even though in adds nontrivial dependency to the code, like libclang |
17:31:21 | PMunch | Well it's only a dependency of Opir |
17:31:43 | PMunch | It's not like your end result depends on libclang |
17:31:52 | FromDiscord | <haxscramper> but you need opir to compile the code, that's what I meant |
17:32:01 | FromDiscord | <haxscramper> of course after codegen happened the binary itself does not require `libclang.so` |
17:32:11 | PMunch | You could even build the opir.json file on a different machine and then send it to someone who then only uses Futhark |
17:32:27 | PMunch | Or just use the generated Futhark cached output of course |
17:32:30 | arkanoid | afaik, opir uses clang to generate a large json that contains a better machine readable version of your C object (what clang uses), then futhark kicks in and reads that json to generate .nim. No clang needed on your program |
17:32:52 | FromDiscord | <haxscramper> ah, so you can commit this as well? |
17:32:58 | PMunch | Yup |
17:33:15 | arkanoid | I actually copied the final .nim and moved to a raspberry, and it worked out. no clang there |
17:33:52 | PMunch | I plan to add a switch to Futhark that removes a lot of the `when defined` stuff from the output. It's only to make it possible to rewrite types, but if you want to distribute a wrapper then it's not really needed. |
17:34:34 | FromDiscord | <haxscramper> Yes, that makes sense. But json is still only a cache, right? |
17:34:44 | PMunch | Yeah the Futhark macro invocation just returns an `import futhark_cache.nim` statement if that file exists |
17:34:56 | FromDiscord | <haxscramper> I.e. all wrapping is on post-macro phase |
17:34:56 | PMunch | The JSON is intended only as a cache, yes |
17:35:09 | PMunch | But you could build a pipeline that processed the JSON file |
17:35:17 | PMunch | Yes |
17:35:30 | PMunch | libclang does all the macro evaluation |
17:36:09 | PMunch | opir.json only includes whatever is defined in your C code |
17:36:26 | PMunch | It's basically a more machine readable header file |
17:36:47 | arkanoid | PMunch: question, is that json representation an invention of yours or clang is able to generate it via command line given the right inputs? Does it have a name / manual page? |
17:36:52 | PMunch | I guess in a way it's what header files where supposed to be :P |
17:37:07 | FromDiscord | <haxscramper> clang can -XdumpJson or something |
17:37:24 | PMunch | It's completely of my own creation, but it does follow some sort of logic, and I plan to document it at some point. |
17:37:36 | PMunch | Clang can't generate it, but nothing stops you from invoking opir from the command line |
17:37:58 | PMunch | It's just a binary executable |
17:38:04 | PMunch | Wait, it can? |
17:38:27 | arkanoid | haxscramper, aren't you doing something for your C++ project? |
17:38:35 | PMunch | So you're telling me that all my work on writing Opir might have been for naught? |
17:39:02 | FromDiscord | <haxscramper> supposedly |
17:39:22 | FromDiscord | <haxscramper> let me check this crap again, I always forget this command line combination |
17:39:41 | FromDiscord | <haxscramper> I just remember some nuclear thread on twitter when someone found out about that |
17:40:07 | PMunch | Welp, I'm getting ready to stream AoC |
17:40:10 | FromDiscord | <haxscramper> `clang test.h -Xclang -ast-dump=json -fsyntax-only` |
17:40:23 | PMunch | Hmm, I definitely have to check that out.. |
17:40:33 | arkanoid | -ast-dump=json ? |
17:40:45 | arkanoid | not sure if AST is what is required |
17:41:09 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=3Hda |
17:41:13 | arkanoid | actually I'm a nood talking to the guys creators of autowrappers. I better wait :D |
17:42:17 | FromDiscord | <haxscramper> Not exactly, it is always a multi-layer-deep "I'm fixing dependencies" stage, and right now I finally started on better compilation errors for nimskull↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
17:42:35 | FromDiscord | <haxscramper> And it involves a nearly whole-compiler fixups, so |
17:42:56 | FromDiscord | <haxscramper> Yes, I'm progressin on this |
17:43:03 | FromDiscord | <haxscramper> well, I actually have a deadline |
17:43:31 | FromDiscord | <haxscramper> I want to write my backelor's project in Qt and nim, so I have to get this ready before Q2 2022 at least |
17:43:42 | FromDiscord | <haxscramper> this is a hard deadline |
17:43:53 | FromDiscord | <haxscramper> until that everything is kind of fuzzy |
17:45:18 | arkanoid | if I do "lang-check-10 --ast-dump /usr/include/arrow-glib/arrow-glib.h" I got something |
17:45:47 | PMunch | By the way, any cool AoC solutions I should mention for the stream today? |
17:48:49 | NimEventer | New thread by Mantielero: C++ bindings - m_type issue , see https://forum.nim-lang.org/t/8683 |
17:49:00 | FromDiscord | <haxscramper> Main difference for hcparse and futhark json is probably the fact I want to give you semantically identical information in more machine-readable way |
17:49:31 | FromDiscord | <haxscramper> So you have the `.json`, but it captures all the conditional compilation logic, all type cycle relations and so on |
17:49:31 | arkanoid | btw: https://reviews.llvm.org/D60910 |
17:50:13 | FromDiscord | <haxscramper> it even has `mangledName` |
17:53:14 | PMunch | Advent of Code, day 6: https://www.twitch.tv/pmunche |
17:53:30 | * | ni-max joined #nim |
17:55:53 | * | ni-max quit (Remote host closed the connection) |
17:56:20 | * | ni-max joined #nim |
17:56:49 | Amun-Ra | now that's a nice beard PMunch |
18:00:50 | NimEventer | New thread by Kobi: MetaCall now has initial support for Nim, see https://forum.nim-lang.org/t/8684 |
18:15:33 | arkanoid | how does nimsuggest search path works regarding ~/.cache/nim ? If I have a .nim file il cache, will it be picked up by nimsuggests for a project living in ~/mynimproj ? |
18:19:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:19:19 | * | ni-max quit (Quit: ni-max) |
18:21:25 | NimEventer | New post on r/nim by mrnothing-: is nim production ready in 2022?, see https://reddit.com/r/nim/comments/raduux/is_nim_production_ready_in_2022/ |
18:28:53 | arkanoid | PMunch: your computer is crashing! :D |
18:39:44 | arkanoid | PMunch: go lazy! regression with machine learning! |
18:56:33 | arkanoid | do you know why there's gintro but no generic interface to GObject/GIR? |
18:56:45 | arkanoid | I mean https://gi.readthedocs.io/en/latest/architecture.html |
19:20:29 | FromDiscord | <enthus1ast> is there a way to provide another object in addition to the object that is destroyed into a finalizer? I guess not |
19:20:52 | FromDiscord | <enthus1ast> other than global |
19:22:38 | FromDiscord | <enthus1ast> i mean i could explicitly call my own finalizer proc but this would mean rewrite |
19:23:58 | * | ni-max joined #nim |
19:25:25 | * | rockcavera quit (Ping timeout: 240 seconds) |
19:27:03 | * | ni-max quit (Remote host closed the connection) |
19:27:35 | * | ni-max joined #nim |
19:28:06 | * | rockcavera joined #nim |
19:28:06 | * | rockcavera quit (Changing host) |
19:28:06 | * | rockcavera joined #nim |
19:29:06 | * | ni-max quit (Remote host closed the connection) |
19:29:34 | FromDiscord | <enthus1ast> can also not be a {.closure.} mhhhh |
19:29:38 | * | ni-max joined #nim |
19:31:05 | * | ni-max quit (Remote host closed the connection) |
19:31:39 | * | ni-max joined #nim |
19:32:44 | * | ni-max quit (Remote host closed the connection) |
19:33:16 | * | ni-max joined #nim |
19:35:45 | arkanoid | PMunch: do you use vim all the times? I am dealing with vscode not using .cache/nim as source and all the futharked code is invisible |
19:36:45 | * | ni-max quit (Remote host closed the connection) |
19:38:08 | * | ni-max joined #nim |
19:39:17 | * | ni-max quit (Remote host closed the connection) |
19:39:49 | * | ni-max joined #nim |
19:40:05 | * | ni-max quit (Client Quit) |
19:47:14 | * | xet7 quit (Quit: Leaving) |
20:19:00 | * | xet7 joined #nim |
20:20:25 | * | perro joined #nim |
20:28:41 | * | xet7 quit (Quit: Leaving) |
20:33:26 | FromDiscord | <pmunch> Yup, I program exclusively in Vim. Even for C# at work, although that's a bit painful because I haven't been bothered to set up OmniSharp completely yet.. |
20:33:55 | FromDiscord | <pmunch> I do need to restart vim after I first compile with Futhark IIRC though |
20:34:30 | FromDiscord | <pmunch> Not quite sure why, maybe it's nimsuggest blacklisting the macro or something 🤷♂️ |
20:34:49 | FromDiscord | <pmunch> I'm also using NimLSP for completions |
20:47:00 | * | vicecea quit (Remote host closed the connection) |
20:47:32 | * | vicecea joined #nim |
20:48:28 | FromDiscord | <ynfle (ynfle)> For some reason, nimlsp goes through periods of not suggesting. Any reason/anyone seen this before? |
20:49:17 | nrds | <Prestige99> I think it's nimsuggest crashing |
20:49:21 | nrds | <Prestige99> happens to me a lot |
20:52:29 | arkanoid | pmunch, no vscode is not picking anything from the nim in .cache/nim |
20:52:39 | arkanoid | using saem extension |
20:52:50 | arkanoid | that's using nimsuggests under the hood |
20:53:11 | arkanoid | actually I don't know if .cache/nim expected to be parsed or not, generally speaking |
20:53:35 | arkanoid | unrelated: changing "maxLoopIterationsVM" in .nims file seems ignored |
20:55:24 | arkanoid | I'm also failing to use it with nimble build |
20:57:00 | * | thelarry joined #nim |
20:58:44 | * | sagax quit (Remote host closed the connection) |
20:58:47 | * | thelarry quit (Client Quit) |
20:59:00 | arkanoid | I'm wrong, it works with nimble |
21:13:24 | * | PMunch quit (Quit: leaving) |
21:26:59 | FromDiscord | <geekrelief> @PMunch in Futhark's description where you compare against nimterop:"nimterop uses treesitter and performs slightly better. It is theoretically able to parse all C syntax, but the C semantics is still up to nimterop to implement. Which means it can't do macros or things like IFDEF automatically." What does "C semantics is still up to nimterop to implement" and "things like IFDEF automatically" mean? |
21:30:01 | FromDiscord | <pmunch> Ah, basically C as a syntax isn't terribly hard to parse. Getting all the words into some nice data structure. But once you throw in pre-processor stuff like IFDEF (analogous to \`when defined\` in Nim) and consider that you can have macros in C that resolves types with IFDEF logic you end up having to do a lot more than just parse the syntax of C in order to understand C. |
21:31:06 | FromDiscord | <pmunch> Think of it like finding the verb, subject, and adjectives in a sentence, but to understand the meaning of the sentence you have to understand context, sarcasm, jokes, etc. |
21:35:19 | arkanoid | pmunch, I'm trying a new thing with futhark! I'm almost there. My target is this in nim: https://gi.readthedocs.io/en/latest/writingbindings/libgirepository.html |
21:36:11 | arkanoid | sadly I have to do stuff like "cast[ptr gchar_436208013]("GLib".cstring)" I yet have to find out if there's a better thing I can do without changes in futhark |
21:36:24 | arkanoid | but json and nim went in place on first try |
21:37:02 | FromDiscord | <pmunch> \`gchar\` should be an alias for \`gchar\_\<number\>\` |
21:38:02 | FromDiscord | <pmunch> Basically those numbers are just to be able to backwards and forward declare variables. It's a bit messy, but it's so that you can provide your own definition of gchar if you wanted to, by simply defining it before calling Futhark |
21:38:47 | tk | In nim, where / how can I split something into multiple lines? |
21:39:14 | FromDiscord | <pmunch> I mean just the fact that you wanted to try another library right after getting the first one to work is a big win in my book. With the other solutions I've always sworn to myself that I would never try to wrap C in Nim again once I'm done with it! |
21:39:33 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3He4 |
21:40:17 | FromDiscord | <dain> i know that max and min on floats have to be done differently to deal with `nan` but it should resolve to their special implementations either way, right? |
21:41:59 | FromDiscord | <geekrelief> In reply to @pmunch "Ah, basically C as": hmm I'd assume running the C code through a preprocessor step would deal with that. I mean nimterop already does that. I'd assume Futharek/clang does that too, right? |
21:42:04 | arkanoid | pmunch, you should be proud of futhark, I'm spending more time in writing that C code in newly created nim bindings than creating the nimble project and setup 7 lines of futhark (importc included!) |
21:42:39 | arkanoid | and it's taking time as I don't have autocompletion, so I have to lookup into .nim and .json what I'm looking for |
21:43:43 | arkanoid | also, instead of copypasting the whole #include list of main .h, now I've just been adding those according to the required "file" entries I found in opir json |
21:43:52 | FromDiscord | <pmunch> Geekrelief, Futhark uses Clang, which is a full blown C compiler. Essentially Clang compiles the code, and Futhark just reads out all the info it needs |
21:43:55 | FromDiscord | <geekrelief> Just FYI, I've been using a forked version of nimterop to bind The Machinery. It took a bit to get going, but things are working out smoothly now. Out of curiosity, I'm still interested in getting Futhark to work for me since I last tried it on Windows. |
21:45:16 | FromDiscord | <pmunch> Arkanoid, thank you, means a lot that other people seem to enjoy it as well \:) I've been using it with great luck myself. Just so much easier to use C libraries when they wrap themselves |
21:45:40 | FromDiscord | <pmunch> Hmm, what was the issues you where running into? |
21:50:04 | arkanoid | I think you should provide a flag to create symlink (or a copy) of the generated .nim file into the project. If the point of futhark is to leave the importc block within the project and not separately, it should promote interop with tools |
21:52:18 | FromDiscord | <pmunch> I was thinking of having a mode where it just spit out a Nim file without all the crazy when statements |
21:52:24 | FromDiscord | <pmunch> So that you could ship it |
21:52:50 | FromDiscord | <pmunch> I'm not sure a local copy would actually do anything that the cache file couldn't do |
21:53:05 | arkanoid | yeah, it could be easier to handle. How you control the cache? Do you check the hashed contents of the importc block? |
21:53:06 | FromDiscord | <geekrelief> sent a long message, see https://paste.rs/K87 |
21:54:30 | FromDiscord | <haxscramper> Futhark was featured on "this month with nim" earlier, right? Maybe you could make note about the progress since that time |
21:54:42 | arkanoid | the problem now is that the suffix of the futhark_*.nim file changes in cache, so symlink has to be re-created every cache clear as a workaround |
21:54:52 | FromDiscord | <haxscramper> And post it again, or at least do a forum thread for this one |
21:55:50 | FromDiscord | <geekrelief> My progress on binding The Machinery. https://media.discordapp.net/attachments/371759389889003532/917534828801450014/tm-nim_first_person.mp4 |
21:55:53 | arkanoid | and also I think that a lanternfish counter should be integrated in futhark for some reason |
21:57:11 | FromDiscord | <geekrelief> Weird I though mp4s were playable in discord. |
21:57:16 | FromDiscord | <geekrelief> (edit) "though" => "thought" |
22:00:34 | FromDiscord | <geekrelief> hmm maybe i's the H.265 codec that's the issue. |
22:00:46 | FromDiscord | <konsumlamm> In reply to @dain "I'm looking in the": i think it's not actually defined as `if x <= y: x else: y`, since it has a `magic` pragma↵might also just be legacy, maybe ask in #internals |
22:01:23 | FromDiscord | <Elegantbeef> You're right |
22:01:41 | FromDiscord | <Elegantbeef> Magic means it goes into the compiler and will emit platform specific code, the body might be used for the VM alone |
22:02:39 | FromDiscord | <Elegantbeef> The reason it's not a single `proc min(x, y: SomeInteger): SomeInteger {.magic: "MinI", noSideEffect.}` is beyond me |
22:04:06 | FromDiscord | <pmunch> Arkanoid, yes it essentially hashes a couple things. So if you change something and then change it back it won't have to rebuild. |
22:04:34 | arkanoid | pmunch, k, I'll use the symlink hack for now. It works |
22:04:49 | FromDiscord | <pmunch> And haxscramper, Futhark hasn't been featured in this month in Nim yet |
22:05:13 | FromDiscord | <haxscramper> Then you certainly should add it here |
22:06:10 | nrds | <Prestige99> pmunch are you able to use compton inside of Xephyr? Seems to not composite, for me |
22:18:26 | * | sagax joined #nim |
22:23:36 | arkanoid | what's the nim way to convert an int return into an if success clause when doing C bindings? |
22:24:52 | FromDiscord | <Elegantbeef> `if procCall() != 0:`? |
22:26:25 | arkanoid | thanks |
22:26:47 | arkanoid | and what would be the nim conversion of "(const GIArgument *)&in_args" ? not sure how to handle const here |
22:27:50 | FromDiscord | <Elegantbeef> I dont think you can, but i dont know the C semantics for const |
22:29:15 | arkanoid | mmm let's try without it, maybe it works |
22:37:58 | arkanoid | pmunch: almost there :) https://play.nim-lang.org/#ix=3Heb |
22:43:02 | * | jjido joined #nim |
22:49:50 | * | thelarry joined #nim |
23:30:48 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:45:34 | * | Vladar quit (Remote host closed the connection) |
23:45:53 | ehmry | is there a way to force the export of an unexported symbol in another module? |
23:46:52 | ehmry | I ned to derefing a ref to an unexported obj before acting on the type |
23:47:57 | ehmry | *need to deref |
23:48:29 | FromDiscord | <Elegantbeef> What do you mean? |
23:49:09 | * | thelarry quit (Quit: Client closed) |
23:51:23 | ehmry | XmlNode is exported but XmlNodeObj is not, and I can't avoid dereferencing XmlNode |
23:52:57 | FromDiscord | <Elegantbeef> I dont see the issue |
23:54:41 | FromDiscord | <Elegantbeef> If you can provide a minimal code example |
23:59:49 | ehmry | nevermind, I can avoid the deref. I'm writing a hook to convert XmlNode to and from another encoding |