<< 06-12-2021 >>

00:00:11*tk quit (Quit: Well, this is unexpected.)
00:00:34*tk joined #nim
00:05:02arkanoidwhat's the actual difference from an inline function and a template?
00:05:25arkanoidapart from the fact that one is metaprogramming and the other is not
00:06:42FromDiscord<ynfle (ynfle)> inline isn't enforced
00:06:46FromDiscord<ynfle (ynfle)> It's a suggestion to the c compiler
00:06:57FromDiscord<ynfle (ynfle)> Template is computed by the VM at compile time
00:07:25FromDiscord<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:56FromDiscord<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:38FromDiscord<Elegantbeef> Ynfle the same can be said about procs and `when`
00:28:45*Colt joined #nim
00:29:25FromDiscord<Fish-Face> is there a built in iterator (or function producing sequences to iterate over) which will count either up or down
00:29:35FromDiscord<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:43FromDiscord<Elegantbeef> you mean `for x in 0..10`?
00:29:56FromDiscord<Fish-Face> if that worked with `10..0` then yes
00:29:58FromDiscord<Elegantbeef> or `for x in countUp(0, 10)` `for x in countDown(10, 0)`?
00:30:16FromDiscord<Elegantbeef> Ah aoc day 5?
00:30:21FromDiscord<Fish-Face> 😉
00:30:35FromDiscord<Elegantbeef> `for x in min(a, b)..max(a, b)`
00:30:48FromDiscord<Fish-Face> hmph
00:31:33FromDiscord<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:20FromDiscord<Elegantbeef> Hey it's how i solved it
00:33:28FromDiscord<Elegantbeef> And my solution is fastish
00:35:40FromDiscord<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:02FromDiscord<retkid> In reply to @Elegantbeef "`var a = create(int,": having trouble assigning a var to this
00:40:05FromDiscord<retkid> wait im thinking about this wrong
00:43:33FromDiscord<retkid> so i can make it its own unique datatype and assign it to a method
00:43:40FromDiscord<retkid> but i cant assign data itself to it?
00:44:22FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H8V
00:44:40FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3H8V" => "https://play.nim-lang.org/#ix=3H8W"
00:44:58FromDiscord<retkid> i mean it works, but for one var thats kinda ugly
00:45:11FromDiscord<retkid> though i do kinda like it so i can organize a lot of data in this type
00:50:19FromDiscord<Elegantbeef> I dont know what you mean
01:07:19arkanoiddo 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:46arkanoidor you know if there's anything that make bindings from gobject introspection?
01:11:05arkanoidI know about gintro but seems tightly coupled with gtk
01:13:24FromDiscord<ynfle (ynfle)> @beef by computer I meant expanded and inlined. Not like static computation
01:13:45FromDiscord<ynfle (ynfle)> \compute
01:14:26FromDiscord<retkid> In reply to @Elegantbeef "I dont know what": As opposed to just doing ↵x= create(int 300)↵x= 1
01:18:57arkanoidynfle. I forgot to thank you for the answer. I got the difference
01:25:02FromDiscord<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:56FromDiscord<ynfle (ynfle)> rika, template vs. inlne?
01:31:52NimEventerNew question by Zecong Hu: Implementing map &amp; 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:11FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H92
01:32:38FromDiscord<Rika> Well yes, an object is not it’s field
01:32:54FromDiscord<retkid> so you can only assign vars to fields in a shared object?
01:32:58FromDiscord<Rika> Oh wait no i misread
01:33:06FromDiscord<retkid> (edit) "shared object?" => "ptr?"
01:33:09FromDiscord<Rika> Okay you can do this with [] after the variable name
01:33:17FromDiscord<Rika> To dereference
01:33:27FromDiscord<retkid> bella, thank you
01:33:30FromDiscord<Elegantbeef> with a field access the compiler knows to deference automagically, with a integer it doesnt
01:33:56FromDiscord<Rika> It technically could
01:34:01FromDiscord<Elegantbeef> you will most likely want to do `cast[ptr array[200, int]](createShared(int, 200))` for the proper logic
01:34:11FromDiscord<Elegantbeef> I mean yes it could if you did `ptr T = T`
01:37:19FromDiscord<retkid> 1 extra thing
01:37:42FromDiscord<retkid> what happens if the var exceeded the bytes assigned to it?
01:38:19FromDiscord<Rika> Undefined behaviour
01:38:29FromDiscord<Rika> Most likely a segmentation fault
01:38:48FromDiscord<retkid> is there anyway to manage this?
01:38:58FromDiscord<retkid> well
01:39:03FromDiscord<retkid> i suppose the answer is yes
01:39:14FromDiscord<retkid> but whats an efficient way to manage this?
01:39:34FromDiscord<retkid> try excepts wont work for the resize?
01:39:45FromDiscord<retkid> (edit) "resize?" => "resize if its a segfault ?"
01:40:34FromDiscord<Rika> Track the size
01:40:40FromDiscord<Rika> And manually handle it
01:40:54FromDiscord<retkid> yea i should just make a thread that just watched it
01:41:05FromDiscord<Rika> Ah this is threaded
01:41:12FromDiscord<Rika> Hmm it might be a bit hard then
01:41:27FromDiscord<Rika> Are you aiming for lock free?
01:41:31FromDiscord<retkid> yea, where do i put the code that just watches it
01:41:43FromDiscord<retkid> In reply to @Rika "Are you aiming for": locks make things complicated, ideally yes
01:42:05FromDiscord<Rika> Lock free makes it more complicated I would say , just an FYI
01:42:22FromDiscord<Elegantbeef> If you're mutating from threads this you pretty much need a lock
01:42:50FromDiscord<Rika> ??? Really
01:42:55FromDiscord<retkid> i dont see why i would
01:43:33FromDiscord<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:40FromDiscord<Rika> I mean for basic stuff you should use locks since it is just simpler and easier
01:44:02FromDiscord<retkid> which i guess is a race condiitoon \
01:44:05FromDiscord<retkid> (edit) "condiitoon \" => "condition"
01:44:10FromDiscord<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:26FromDiscord<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:39FromDiscord<Rika> So you have to use some sort of synchronisation method
01:45:07FromDiscord<retkid> it would be add only
01:45:20FromDiscord<retkid> managing deleting and adding is too much of a nightmare
01:45:27FromDiscord<Rika> Even if it is add only
01:45:32FromDiscord<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:38FromDiscord<Rika> If two threads add at the same time one add will be lost
01:45:48FromDiscord<retkid> nothing iterates over it i dont think
01:46:00FromDiscord<retkid> In reply to @Elegantbeef "There is the even": i also have a iterator for this
01:46:05FromDiscord<retkid> (edit) "a" => "an"
01:46:24FromDiscord<Elegantbeef> I mean if you're adding whilst accessing you have an issue
01:46:32FromDiscord<Elegantbeef> iterating was just a long operation
01:46:32FromDiscord<retkid> ah
01:46:35FromDiscord<Rika> An iterator would need a lock or a copy of the data so it doesn’t change
01:46:55FromDiscord<retkid> think i posted this guy here before
01:47:02FromDiscord<retkid> this guy is recursive
01:47:04FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H93
01:47:07FromDiscord<retkid> dont think it works for this though
01:47:16FromDiscord<retkid> (edit)
01:47:44FromDiscord<retkid> i used to have a sleep in there idk where it went
01:48:01FromDiscord<Rika> Still if something changes then you probably just yielded malformed data
01:48:32FromDiscord<Elegantbeef> The only time you can do lockfree stuff is if your algorithm or design prevents race conditions
01:48:51FromDiscord<Rika> Yeah of course
01:49:04FromDiscord<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:13FromDiscord<retkid> i could make it read the ptr every 5 seconds
01:49:20FromDiscord<retkid> so it always has a seperate state
01:49:22FromDiscord<retkid> (edit) "seperate" => "separate"
01:50:00FromDiscord<Elegantbeef> If you only grow then you never have any race conditions if this is never mutated aside from that
01:50:30FromDiscord<Elegantbeef> With my example of course
01:51:19FromDiscord<retkid> so you mean the last entry in the sequence is a pointer
01:51:30FromDiscord<retkid> and you insert to 1 before that?
01:51:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3H95
01:51:36FromDiscord<Rika> Only adding still has race conditions
01:51:57FromDiscord<Elegantbeef> You lock the pointer when adding of course
01:52:07FromDiscord<Elegantbeef> but that gives you a much smaller lock foot print
01:52:14FromDiscord<retkid> echo seqence[sequence.len()-1] changes as its done
01:52:16FromDiscord<Rika> It’s still a lock
01:52:28FromDiscord<retkid> (edit) "done" => "operated"
01:52:32FromDiscord<Elegantbeef> Of course
02:19:09arkanoidI'm trying to install futhark but I keep getting "/usr/bin/ld: cannot find -lclang"
02:19:27arkanoidI'm trying with "nimble install --passl:-L/usr/lib/llvm-10/lib futhark"
02:19:43arkanoidlib is in /usr/lib/llvm-10/lib/libclang.so.1
02:20:57arkanoidcomplete error is: https://play.nim-lang.org/#ix=3H9a
02:21:07arkanoidit seems to me that -l and -L args are in wrong order
02:21:54arkanoidshoudn't -L<path> come before -lclang ?
02:25:11*neurocyte0132889 quit (Ping timeout: 252 seconds)
02:29:18arkanoidoh dear, I had to manually create symlink, just like here https://github.com/lvzixun/Clang-Complete/issues/49
02:46:26FromDiscord<Delta> does nim have any unit testing tools/libs that support test caching?
02:52:48*arkurious quit (Quit: Leaving)
03:01:04FromDiscord<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:43arkanoidDelta, what is test caching?
03:43:23FromDiscord<Delta> If you've ever used `go test`, it can cache the results of unit tests that refer to unchanged code
03:43:58FromDiscord<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:32NimEventerNew 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:26FromDiscord<retkid> is there an async function to do something at an interval
07:17:21FromDiscord<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:18FromDiscord<retkid> In reply to @Yardanico "https://nim-lang.org/docs/asyncdispatch.html#addTim": well i want it to continue the code
07:18:46FromDiscord<Yardanico> ??
07:18:52FromDiscord<Yardanico> it won't block your other async tasks
07:19:02FromDiscord<Yardanico> since it'll sleep with `sleepAsync` and not `sleep`
07:19:13FromDiscord<retkid> sorry my async ideas have been corrupted by JS
07:20:23FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3H9N
07:20:43FromDiscord<Yardanico> just do like `doStuff` and call it from your main routine with `asyncCheck doStuff()`
07:21:03FromDiscord<Yardanico> asyncCheck is needed so that if doStuff throws an exception, it'll actually be caught and will stop program execution
07:21:22FromDiscord<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:29FromDiscord<retkid> HEY
07:33:31FromDiscord<retkid> I did lockless
07:34:03FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9Q
07:34:08FromDiscord<retkid> list = a[] removes the race condition
07:34:35FromDiscord<retkid> problem is there is no good gcc so it consumes too much ram so it just kinda hangs
07:35:44FromDiscord<retkid> ah nevermind getting segfaults?
07:36:16FromDiscord<Yardanico> ???
07:37:47*PMunch joined #nim
07:37:52FromDiscord<retkid> oh it was a conversation from earlier
07:41:01*pch quit (Quit: Leaving)
07:49:16FromDiscord<retkid> fuck it, its lock time↵'
07:49:17FromDiscord<retkid> (edit) "time↵'" => "time"
07:49:22FromDiscord<retkid> (edit) removed "fuck it,"
07:51:48*jjido joined #nim
07:58:29FromDiscord<n00nehere> hey
07:58:48FromDiscord<n00nehere> i am trying to use webview library of juancarlospaco
07:58:58FromDiscord<n00nehere> but when trying to use as html a variable i get the following error
07:58:59FromDiscord<n00nehere> first type mismatch at position\: 1↵ required type for path\: static[string]↵ but expression 'dataUriHtmlHeader' is of type\: string
07:59:35FromDiscord<Yardanico> well, the proc says it requires you to specify the string that is known at compile time
07:59:39FromDiscord<Yardanico> so you can't provide a runtime string to it
07:59:43FromDiscord<Yardanico> not `let` but `const`
07:59:54FromDiscord<Yardanico> did you see https://github.com/marcomq/nimview btw?
08:00:01FromDiscord<retkid> god
08:00:02FromDiscord<retkid> const
08:00:08FromDiscord<n00nehere> not yet↵(@Yardanico)
08:00:12FromDiscord<retkid> i forgot about const
08:00:24FromDiscord<n00nehere> yea it was a const the problem
08:00:26FromDiscord<n00nehere> i was using var
08:00:33FromDiscord<n00nehere> but looks like it fucking dies if i use var
08:00:35FromDiscord<retkid> thats fair
08:00:44FromDiscord<retkid> i've never had to use const
08:00:45FromDiscord<retkid> for anythiong
08:00:47FromDiscord<retkid> (edit) "anythiong" => "anything"
08:00:52FromDiscord<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:53FromDiscord<n00nehere> same↵(@retkid)
08:01:01FromDiscord<retkid> outside of JS
08:01:02FromDiscord<Yardanico> static[string] in a proc definition requires the string to be known at compile-time
08:01:06FromDiscord<n00nehere> never used const, idk
08:01:07FromDiscord<retkid> JS has a const fetish
08:01:19FromDiscord<n00nehere> js is weird in general↵(@retkid)
08:01:21FromDiscord<Yardanico> In reply to @retkid "JS has a const": because it has very different semantics from `const` in nim
08:01:27FromDiscord<Yardanico> nim IMO has one of the cleanest semantics for variable modifiers\
08:01:28FromDiscord<Yardanico> (edit) "modifiers\" => "modifiers"
08:01:32FromDiscord<Yardanico> `var` - runtime, mutable
08:01:39FromDiscord<Yardanico> `let` - runtime, immutable (except ref)
08:01:44FromDiscord<Yardanico> `const` - compile-time, immutable
08:01:58FromDiscord<Yardanico> modifiers don't affect the scope because in nim it's always the local scope
08:02:19FromDiscord<retkid> i don't really like : as a type declaration
08:02:20FromDiscord<Yardanico> we do have `{.global.}` pragma for declaring global variables inside of procedures, but it's a bit buggy
08:02:21FromDiscord<retkid> prefer kotlins
08:02:29FromDiscord<Yardanico> In reply to @retkid "i don't really like": you don't need it in most cases
08:02:35FromDiscord<Yardanico> i mean for variables
08:02:49FromDiscord<retkid> not kotlins, kotlin has the same
08:02:49FromDiscord<n00nehere> well nimview is still alive i see↵(@Yardanico)
08:02:52FromDiscord<retkid> except its like
08:03:16FromDiscord<retkid> i like javas
08:03:17FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9V
08:03:26FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3H9W
08:03:33FromDiscord<Yardanico> well, in nim for these cases you can just do `var x = 328`
08:03:47FromDiscord<retkid> yea but you do
08:03:48FromDiscord<n00nehere> guess i will rewrite everything to use it
08:03:54FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
08:04:12FromDiscord<Yardanico> sent a code paste, see https://paste.rs/Uf1
08:04:13FromDiscord<Yardanico> (edit) "https://play.nim-lang.org/#ix=3H9Y" => "https://play.nim-lang.org/#ix=3H9Z"
08:04:22FromDiscord<retkid> but it doesn't
08:04:23FromDiscord<Yardanico> since you "don't like the type"
08:04:24FromDiscord<retkid> java is insane
08:04:25FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Ha0
08:04:31FromDiscord<Yardanico> (edit) "type"" => "syntax""
08:04:34FromDiscord<retkid> (edit)
08:04:40FromDiscord<retkid> i forget how to make a list off the top of my head in java
08:04:45FromDiscord<retkid> its stupid
08:05:09FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3Ha0" => "https://play.nim-lang.org/#ix=3Ha1"
08:05:10FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3Ha1" => "https://play.nim-lang.org/#ix=3Ha0"
08:05:16FromDiscord<Solitude> how do i unsubscribe from your blog?
08:05:28FromDiscord<retkid> you dont :")
08:05:38FromDiscord<Yardanico> we can go to #offtopic to discuss this really
08:05:45FromDiscord<Yardanico> a much better place :)
08:11:12*pch joined #nim
08:18:17FromDiscord<tbrekalo> https://play.nim-lang.org/#ix=3Ha7↵↵can I generate a random name for the `cy000cle` variable in this code snippet?
08:19:07FromDiscord<Yardanico> it's already "random" because nim templates are hygienic by default
08:19:23FromDiscord<Yardanico> you won't be able to access "cy000cle" from the code `repeatBlock(2): code`
08:19:29FromDiscord<Elegantbeef> For instance
08:19:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ha8
08:19:38FromDiscord<Elegantbeef> It errors as yardanico pointed out
08:20:02FromDiscord<Yardanico> you can also make it `for _ in 0 ..< n` too if you don't like having a "real" variable name there :)
08:20:17FromDiscord<Elegantbeef> if you do want to inject symbols you need to do `{.dirty.}` on the template or `for it {.inject.} 0 ..<n:`
08:20:21FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates
08:20:23FromDiscord<tbrekalo> so I can't access `it` inside the `body` ?
08:20:26FromDiscord<Yardanico> yes
08:20:30FromDiscord<Yardanico> "Per default, templates are hygienic: Local identifiers declared in a template cannot be accessed in the instantiation context:"
08:20:45FromDiscord<tbrekalo> thanks! 🙂
08:21:08FromDiscord<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:33NimEventerNew 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:44PMunch@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:44FromDiscord<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:05FromDiscord<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:51FromDiscord<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:56PMunchC should be able to be integrated in C++ fairly easily I believe
14:15:11PMunchOtherwise you'd probably have to build libraries and link them together
14:28:31*arkurious joined #nim
14:35:00FromDiscord<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:20FromDiscord<Schelz> so i could tweak it if i resolve "cimgui.dll"
14:35:28FromDiscord<Schelz> any idea how to solve ?
14:37:10*Vladar joined #nim
14:38:22FromDiscord<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:28FromDiscord<Yardanico> and with C++ backend it uses imgui itself
14:38:58FromDiscord<Schelz> so i could compile it with C right ?
14:39:38FromDiscord<Yardanico> yes but you'll need to use cimgui.so
14:39:50FromDiscord<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:01FromDiscord<Yardanico> why not just use c++ backend for everything?
14:40:31FromDiscord<Schelz> cause i use C in the main code for a subhook and it working only with C
14:41:19FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Hc7
14:42:01FromDiscord<Rika> Afaik the discriminant must be 0 because of defaults
14:42:09FromDiscord<Rika> So I believe not
14:42:36FromDiscord<Schelz> @Yardanico do you have the cimgui.dll or do you know where can i get it from ?
14:42:49FromDiscord<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:26FromDiscord<haxscramper> Just like any `enum` with offset
14:43:27FromDiscord<haxscramper> broken value
14:43:36FromDiscord<Yardanico> In reply to @Schelz "<@!177365113899057152> do you have": you have to compile it yourself :()
14:43:49FromDiscord<Yardanico> sorry, can't help now, i'm a bit busy
14:43:50FromDiscord<Rika> and broken object definition?
14:44:05FromDiscord<Schelz> ok thanks for tip
14:44:05FromDiscord<Rika> enum value being 0 and broken is "fine"
14:44:09FromDiscord<haxscramper> yes, we don't have valid defaults so I would at least expect this to be possible
14:44:55FromDiscord<Rika> well it isnt because its not "everything is broken" its just "some things are broken and some things are correct"
14:45:07FromDiscord<Rika> you could say its worse yes
14:45:14PMunchHmm, anyone else tried the Pizza Slicing Google doodle for today?
14:45:52FromDiscord<Rika> no i dont use google
14:46:37FromDiscord<haxscramper> Damn, it invites some really ugly code otherwise, without ranges
14:47:31FromDiscord<Rika> yeah i really cant wait for better default
14:55:11arkanoidPMunch: 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:31PMunchI 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:56PMunchI'm about to head home now. But if you see me online don't hesitate to ask about how to use it :)
14:59:29arkanoidwell, I'm still trying to make GARROW_ARRAY_BUILDER work
14:59:44PMunchAre you still importing the cache file directly?
15:00:12PMunchThe importc macro should automatically rebuild or simply resolve to import that file
15:00:17PMunchSo you shouldn't import it manually
15:00:30arkanoidyep, is there a difference once the .json and .nim file have been built?
15:01:05arkanoidI did that just to have autocompletion in editor, but yes actually is not what you wrote in the example
15:01:11arkanoidlet me rever it
15:04:10arkanoidI have the same problem without importing cache direction but coding straight below importc block
15:04:19arkanoids/direction/directly
15:06:16PMunchYeah I don't think that's related to your error
15:06:33arkanoidoutput on futhark/opir says "Hint: Renaming "GARROW_ARRAY_BUILDER" to "Garrowarraybuilderproc" [User]"
15:07:19PMunchThat means that there exists something called Garrowarraybuilder already
15:07:51PMunchI assume that is "GArrowArrayBuilder"
15:08:48PMunchOkay, gotta go
15:08:55PMunchI'll have a look at this later
15:09:05*PMunch quit (Quit: Leaving)
15:10:03arkanoidsure, thanks, In the meanwhile I've pasted the complete output of futhark run with cache cleared
15:23:31FromDiscord<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:03FromDiscord<n00nehere> how do i convert something to a string?
15:54:59FromDiscord<Yardanico> $
15:55:07FromDiscord<n00nehere> thanks
15:56:05noeontheendIf you need to define it yourself, then you can write your own "proc `$`(self: T): string"
15:57:13noeontheend`proc \`$\`(self: T): string` <- does that work?
15:57:35noeontheendNope. Anyways, the $ is wrapped in backticks to show that it's an operator.
15:57:36FromDiscord<Yardanico> yes
15:57:46FromDiscord<Yardanico> ah you meant if it will be displayed fine on discord
15:58:18noeontheend:)
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:55PMuncharkanoid, I'm trying to install arrow-glib so I can test myself but I get an error while building it
17:02:24arkanoidPMunch: wait, you got me in the moment I've just succeeded in building and executing the example! I'm updating the issue
17:02:26PMunchhttp://ix.io/3Hd0
17:02:33PMunchOh nice!
17:03:00PMunchI thought it might be that you simply didn't link to the sources, but I might be mistaken
17:04:36arkanoidPMunch: no, it's something about macro not binded correctly
17:05:17PMunchAh right, yeah macros are a bit of a pain
17:05:55arkanoidI'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:41PMunchI was just trying to install it via pakku
17:06:57arkanoiddon't know pakku, sounds new to me, let me google
17:07:16PMunchIt's an alternative to yaourt
17:07:22PMunchArch package manager
17:07:46PMunchAh, the package is flagged as out of date
17:07:59arkanoidoh! archlinux. Long time no see
17:11:35arkanoidbtw, 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:38arkanoidconversion of macros 4) why use .cache/nim? this kills autocompletion and stuff
17:13:09arkanoidbut 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:50PMunch1) 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:50PMunchFuthark, 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:45PMunchThe 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:23PMunchI 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:52PMunchI was able to import X11 to a level that's better than the published wrappers in a matter of minutes
17:25:02arkanoidPMunch: 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:18PMunchExactly
17:25:29PMunchAnd then a new version of the library drops and you have to start over
17:25:57PMunchOr just assume your bindings work and have potential cryptic segfaults in your future
17:26:24PMunch(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:38arkanoidI tried to push whatever possible into name mangling rules
17:26:41PMunchI still worked, but that was probably more dumb luck than anything..
17:26:52arkanoidI'm actually surprised how small is the source code of futhark
17:27:03*krux02 quit (Remote host closed the connection)
17:27:05PMunchI mean most of the heavy lifting is done by clang
17:27:24*krux02 joined #nim
17:27:34arkanoidthis seems the right approach, why isn't this the default one?
17:27:38PMunchOpir 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:47PMunchIt is the default one for me :P
17:27:59FromDiscord<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:12FromDiscord<haxscramper> the libclang one?
17:28:15arkanoidI 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:47PMunchThe problem with macros is that they don't have types
17:28:49FromDiscord<haxscramper> Well, araq is convinced his hand-rolled C parser is robust enough
17:28:52FromDiscord<haxscramper> Who are we to argue
17:29:23PMunchMacros in C are just text substitution, so it's hard to reason about how to wrap them in Nim..
17:29:35FromDiscord<n00nehere> hey, do someone here know how to use winim or winapi in general?
17:29:37FromDiscord<haxscramper> advancement in this field has always been an efforst of a singular person
17:29:47FromDiscord<haxscramper> shashlick, then I started it
17:29:56FromDiscord<n00nehere> i need to clear the clipboard content every hour but i can't manage to get the clipboard to work
17:29:58FromDiscord<haxscramper> then pmuch made futhark
17:29:59PMunch@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:17arkanoidI 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:19FromDiscord<n00nehere> if i open the clipboard and try to read or delete the content i just get a 0
17:30:20FromDiscord<haxscramper> futhark works great, hcparse at this stage is mostly an R&D project
17:30:28FromDiscord<haxscramper> it is too complex to give meaningful timeframes
17:30:42FromDiscord<haxscramper> Well, the problem formulation is much more complicated
17:31:05FromDiscord<haxscramper> But futhark is a great solution, even though in adds nontrivial dependency to the code, like libclang
17:31:21PMunchWell it's only a dependency of Opir
17:31:43PMunchIt's not like your end result depends on libclang
17:31:52FromDiscord<haxscramper> but you need opir to compile the code, that's what I meant
17:32:01FromDiscord<haxscramper> of course after codegen happened the binary itself does not require `libclang.so`
17:32:11PMunchYou could even build the opir.json file on a different machine and then send it to someone who then only uses Futhark
17:32:27PMunchOr just use the generated Futhark cached output of course
17:32:30arkanoidafaik, 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:52FromDiscord<haxscramper> ah, so you can commit this as well?
17:32:58PMunchYup
17:33:15arkanoidI actually copied the final .nim and moved to a raspberry, and it worked out. no clang there
17:33:52PMunchI 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:34FromDiscord<haxscramper> Yes, that makes sense. But json is still only a cache, right?
17:34:44PMunchYeah the Futhark macro invocation just returns an `import futhark_cache.nim` statement if that file exists
17:34:56FromDiscord<haxscramper> I.e. all wrapping is on post-macro phase
17:34:56PMunchThe JSON is intended only as a cache, yes
17:35:09PMunchBut you could build a pipeline that processed the JSON file
17:35:17PMunchYes
17:35:30PMunchlibclang does all the macro evaluation
17:36:09PMunchopir.json only includes whatever is defined in your C code
17:36:26PMunchIt's basically a more machine readable header file
17:36:47arkanoidPMunch: 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:52PMunchI guess in a way it's what header files where supposed to be :P
17:37:07FromDiscord<haxscramper> clang can -XdumpJson or something
17:37:24PMunchIt'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:36PMunchClang can't generate it, but nothing stops you from invoking opir from the command line
17:37:58PMunchIt's just a binary executable
17:38:04PMunchWait, it can?
17:38:27arkanoidhaxscramper, aren't you doing something for your C++ project?
17:38:35PMunchSo you're telling me that all my work on writing Opir might have been for naught?
17:39:02FromDiscord<haxscramper> supposedly
17:39:22FromDiscord<haxscramper> let me check this crap again, I always forget this command line combination
17:39:41FromDiscord<haxscramper> I just remember some nuclear thread on twitter when someone found out about that
17:40:07PMunchWelp, I'm getting ready to stream AoC
17:40:10FromDiscord<haxscramper> `clang test.h -Xclang -ast-dump=json -fsyntax-only`
17:40:23PMunchHmm, I definitely have to check that out..
17:40:33arkanoid-ast-dump=json ?
17:40:45arkanoidnot sure if AST is what is required
17:41:09FromDiscord<haxscramper> https://play.nim-lang.org/#ix=3Hda
17:41:13arkanoidactually I'm a nood talking to the guys creators of autowrappers. I better wait :D
17:42:17FromDiscord<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:35FromDiscord<haxscramper> And it involves a nearly whole-compiler fixups, so
17:42:56FromDiscord<haxscramper> Yes, I'm progressin on this
17:43:03FromDiscord<haxscramper> well, I actually have a deadline
17:43:31FromDiscord<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:42FromDiscord<haxscramper> this is a hard deadline
17:43:53FromDiscord<haxscramper> until that everything is kind of fuzzy
17:45:18arkanoidif I do "lang-check-10 --ast-dump /usr/include/arrow-glib/arrow-glib.h" I got something
17:45:47PMunchBy the way, any cool AoC solutions I should mention for the stream today?
17:48:49NimEventerNew thread by Mantielero: C++ bindings - m_type issue , see https://forum.nim-lang.org/t/8683
17:49:00FromDiscord<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:31FromDiscord<haxscramper> So you have the `.json`, but it captures all the conditional compilation logic, all type cycle relations and so on
17:49:31arkanoidbtw: https://reviews.llvm.org/D60910
17:50:13FromDiscord<haxscramper> it even has `mangledName`
17:53:14PMunchAdvent 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:49Amun-Ranow that's a nice beard PMunch
18:00:50NimEventerNew thread by Kobi: MetaCall now has initial support for Nim, see https://forum.nim-lang.org/t/8684
18:15:33arkanoidhow 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:25NimEventerNew 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:53arkanoidPMunch: your computer is crashing! :D
18:39:44arkanoidPMunch: go lazy! regression with machine learning!
18:56:33arkanoiddo you know why there's gintro but no generic interface to GObject/GIR?
18:56:45arkanoidI mean https://gi.readthedocs.io/en/latest/architecture.html
19:20:29FromDiscord<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:52FromDiscord<enthus1ast> other than global
19:22:38FromDiscord<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:34FromDiscord<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:45arkanoidPMunch: 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:26FromDiscord<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:55FromDiscord<pmunch> I do need to restart vim after I first compile with Futhark IIRC though
20:34:30FromDiscord<pmunch> Not quite sure why, maybe it's nimsuggest blacklisting the macro or something 🤷‍♂️
20:34:49FromDiscord<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:28FromDiscord<ynfle (ynfle)> For some reason, nimlsp goes through periods of not suggesting. Any reason/anyone seen this before?
20:49:17nrds<Prestige99> I think it's nimsuggest crashing
20:49:21nrds<Prestige99> happens to me a lot
20:52:29arkanoidpmunch, no vscode is not picking anything from the nim in .cache/nim
20:52:39arkanoidusing saem extension
20:52:50arkanoidthat's using nimsuggests under the hood
20:53:11arkanoidactually I don't know if .cache/nim expected to be parsed or not, generally speaking
20:53:35arkanoidunrelated: changing "maxLoopIterationsVM" in .nims file seems ignored
20:55:24arkanoidI'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:00arkanoidI'm wrong, it works with nimble
21:13:24*PMunch quit (Quit: leaving)
21:26:59FromDiscord<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:01FromDiscord<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:06FromDiscord<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:19arkanoidpmunch, 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:11arkanoidsadly 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:24arkanoidbut json and nim went in place on first try
21:37:02FromDiscord<pmunch> \`gchar\` should be an alias for \`gchar\_\<number\>\`
21:38:02FromDiscord<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:47tkIn nim, where / how can I split something into multiple lines?
21:39:14FromDiscord<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:33FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3He4
21:40:17FromDiscord<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:59FromDiscord<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:04arkanoidpmunch, 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:39arkanoidand 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:43arkanoidalso, 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:52FromDiscord<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:55FromDiscord<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:16FromDiscord<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:40FromDiscord<pmunch> Hmm, what was the issues you where running into?
21:50:04arkanoidI 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:18FromDiscord<pmunch> I was thinking of having a mode where it just spit out a Nim file without all the crazy when statements
21:52:24FromDiscord<pmunch> So that you could ship it
21:52:50FromDiscord<pmunch> I'm not sure a local copy would actually do anything that the cache file couldn't do
21:53:05arkanoidyeah, it could be easier to handle. How you control the cache? Do you check the hashed contents of the importc block?
21:53:06FromDiscord<geekrelief> sent a long message, see https://paste.rs/K87
21:54:30FromDiscord<haxscramper> Futhark was featured on "this month with nim" earlier, right? Maybe you could make note about the progress since that time
21:54:42arkanoidthe 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:52FromDiscord<haxscramper> And post it again, or at least do a forum thread for this one
21:55:50FromDiscord<geekrelief> My progress on binding The Machinery. https://media.discordapp.net/attachments/371759389889003532/917534828801450014/tm-nim_first_person.mp4
21:55:53arkanoidand also I think that a lanternfish counter should be integrated in futhark for some reason
21:57:11FromDiscord<geekrelief> Weird I though mp4s were playable in discord.
21:57:16FromDiscord<geekrelief> (edit) "though" => "thought"
22:00:34FromDiscord<geekrelief> hmm maybe i's the H.265 codec that's the issue.
22:00:46FromDiscord<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:23FromDiscord<Elegantbeef> You're right
22:01:41FromDiscord<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:39FromDiscord<Elegantbeef> The reason it's not a single `proc min(x, y: SomeInteger): SomeInteger {.magic: "MinI", noSideEffect.}` is beyond me
22:04:06FromDiscord<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:34arkanoidpmunch, k, I'll use the symlink hack for now. It works
22:04:49FromDiscord<pmunch> And haxscramper, Futhark hasn't been featured in this month in Nim yet
22:05:13FromDiscord<haxscramper> Then you certainly should add it here
22:06:10nrds<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:36arkanoidwhat's the nim way to convert an int return into an if success clause when doing C bindings?
22:24:52FromDiscord<Elegantbeef> `if procCall() != 0:`?
22:26:25arkanoidthanks
22:26:47arkanoidand what would be the nim conversion of "(const GIArgument *)&in_args" ? not sure how to handle const here
22:27:50FromDiscord<Elegantbeef> I dont think you can, but i dont know the C semantics for const
22:29:15arkanoidmmm let's try without it, maybe it works
22:37:58arkanoidpmunch: 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:53ehmryis there a way to force the export of an unexported symbol in another module?
23:46:52ehmryI ned to derefing a ref to an unexported obj before acting on the type
23:47:57ehmry*need to deref
23:48:29FromDiscord<Elegantbeef> What do you mean?
23:49:09*thelarry quit (Quit: Client closed)
23:51:23ehmryXmlNode is exported but XmlNodeObj is not, and I can't avoid dereferencing XmlNode
23:52:57FromDiscord<Elegantbeef> I dont see the issue
23:54:41FromDiscord<Elegantbeef> If you can provide a minimal code example
23:59:49ehmrynevermind, I can avoid the deref. I'm writing a hook to convert XmlNode to and from another encoding