jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
alexherbo2 has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
_whitelogger has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 264 seconds]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter> <HertzDevil> ruby used to yield 2 values too
<FromGitter> <HertzDevil> apparently they turned back to 2-element array for 3.0 preview
<FromGitter> <grkek> I wrote a dialect for HTML
<FromGitter> <grkek> hooked in the duktape js engine
<FromGitter> <grkek> and built it on top of gtk
<FromGitter> <grkek> and it looks like this
<FromGitter> <grkek> what do you guys think of it?
<FromGitter> <grkek> Waste of time and 3 days or nah?
<FromGitter> <grkek> https://github.com/grkek/layout
<FromGitter> <grkek> it resides here if you guys want to check it out :p
<FromGitter> <grkek> Seems like I need to monkey patch the duktape library cuz I forgot to do so :p
deavmi has quit [Ping timeout: 268 seconds]
deavmi has joined #crystal-lang
Liothen has quit [Ping timeout: 260 seconds]
Liothen has joined #crystal-lang
<FromGitter> <grkek> How does one pass a clojure to C?
return0e[m] has quit [Quit: Idle for 30+ days]
ua has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <grkek> I am kind of slow with C
<FromGitter> <grkek> could anyone help?
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9e8a9c8a236947ba7ab1ad]
sorcus has quit [Quit: WeeChat 2.9]
sorcus has joined #crystal-lang
<jhass> well, as it says at the bottom, you found a bug in the compiler :)
<jhass> (or potentially LLVM)
<FromGitter> <grkek> Not with that :P I mean the gobject library
<FromGitter> <grkek> I want to access the window resize function from a javascript engine of the duktape global proc definition
<FromGitter> <grkek> Didn't word that right but you get what I mean
f1reflyylmao is now known as f1refly
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<FromGitter> <j8r> @HertzDevil @wyhaines oprypin point me that it is because of the `Enumerable(Typle(K, V))` interface to implement
<FromGitter> <j8r> I don't know if changing `Enumerable(T)` to `Enumerable(*T)` can make it
ua has quit [Ping timeout: 264 seconds]
<raz> grkek: i love it! (layout) no idea if i'll ever find an excuse to actually use it, but declarative seems to be the way to go
ua has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
HumanG33k has joined #crystal-lang
<FromGitter> <grkek> Thank you mate, I don't even know if Ill be able to finish it tho
<FromGitter> <grkek> When you pass a constant into a closure it doesn't panic and seems not to care at all
<oprypin> grkek, yea that's fine. and, well, it's not a closure at that point
<FromGitter> <grkek> Can you help me, mr magicman
<oprypin> a closure needs to be formed when the proc refers to a variable which doesn't have a fixed memory address (but constants have it)
<FromGitter> <grkek> ?
<oprypin> grkek, whats the problem
<FromGitter> <grkek> How does one do this?
<FromGitter> <grkek> It errors out saying that I can't pass a closure to c
<oprypin> i dont know anything about Duktape
<FromGitter> <grkek> here are those two functions which are used.
mps has left #crystal-lang [#crystal-lang]
<oprypin> grkek, duktape.cr could do a much better job i think
<oprypin> i currently have no understanding of the "stack" in duktape.cr
<oprypin> i suspect something can be done with `duk_push_pointer(Box.box(block))` as per https://crystal-lang.org/reference/syntax_and_semantics/c_bindings/callbacks.html#passing-a-closure-to-a-c-function
<FromGitter> <grkek> Let me try :)
<oprypin> i think `push_proc` could be something like `LibDUK.push_pointer(Box.box(block)); LibDUK.push_c_function(ctx, -> { |ctx| Box(typeof(block)).unbox(LibDUK.get_pointer).call(ctx) }, nargs)`
<oprypin> then it'd seamlessly support closures
<oprypin> i'm just really uncertain about the stack interaction, my usage of `get_pointer` is a pure guess
<oprypin> grkek,
<oprypin> uh i mean @grkek
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f01e9f2fd4f60fc493db0]
<FromGitter> <grkek> What does it want hmm
<oprypin> uh maybe the space is not allowed
<oprypin> `->{`
<oprypin> lol no it says exactly what it wants
<FromGitter> <grkek> So what is the context
<oprypin> the syntax is `->(ctx) {`
<oprypin> i have no idea, totally not possible to trace it back the way this lib is organized
<oprypin> god i hate the standards that ruby has set
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f0291b86f64070424ea0d]
<FromGitter> <grkek> That is odd
<FromGitter> <grkek> the push pointer function has 1 args
<oprypin> push_pointer has 1; LibDUK.push_pointer has 2
<FromGitter> <grkek> What is the other one?
<oprypin> the last link i sent
<FromGitter> <grkek> Oh
<FromGitter> <grkek> I am still stuck
<FromGitter> <grkek> Where do I get the index from?
<oprypin> grkek, maybe it's -1
<FromGitter> <grkek> ill try
<FromGitter> <grkek> thank you :)
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f046dbf955735eb521eb9]
<FromGitter> <grkek> Well, at least we tried?
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f04992a35440715fb92f5]
<FromGitter> <grkek> Here is my monkey patch
<oprypin> grkek, the answer is somewhere here. you just need to learn how duktape stack works
<FromGitter> <grkek> Oh lol
<FromGitter> <grkek> I changed -2 to -1
<FromGitter> <grkek> and it worked?
<FromGitter> <grkek> Well no
<oprypin> `.get_pointer(ctx, 4)` why 4
<FromGitter> <grkek> I don't really know
<FromGitter> <grkek> what should I use there?
<FromGitter> <grkek> Sorry that I am so slow with pointers
<oprypin> the main thing i see from here is that these values must never be positive for this purpose
<oprypin> not to mention that i directly said that "-1" should probably be the index
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f0683c6fe0131d4cbec21]
<FromGitter> <grkek> Again an error that I don't understand why
<FromGitter> <grkek> it is still defining the string at -2\
<FromGitter> <grkek> what is the problem hmmm...
<oprypin> i dont think `push_global_proc` should be changed
<FromGitter> <grkek> If I put both -1
<FromGitter> <grkek> i get a segfault
<oprypin> it's originally -2 so why do u put -1
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f06d8f2fd4f60fc4948ee]
<FromGitter> <grkek> Damn it I hate C
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 258 seconds]
alexherbo20 is now known as alexherbo2
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f9f0f412a35440715fbaa9d]
<FromGitter> <grkek> If i replace the push_costom_proc push_c_function proc details it works
<FromGitter> <grkek> if it has none of that proc = Box
<FromGitter> <grkek> it works but when I try this way it crashes
<FromGitter> <grkek> the get pointer function returns a pointer(void).null
teardown has quit [Ping timeout: 240 seconds]
yukai has joined #crystal-lang
teardown has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang