RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <asterite> I always use gitter from the website, it works pretty well: https://gitter.im/crystal-lang/crystal
early has quit [Quit: Leaving]
early has joined #crystal-lang
DTZUZO has joined #crystal-lang
moei has quit [Quit: Leaving...]
snapcase has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 272 seconds]
Raimondii is now known as Raimondi
pabs has quit [Ping timeout: 240 seconds]
druonysus has quit [Ping timeout: 240 seconds]
ua has quit [Ping timeout: 260 seconds]
DTZUZO has quit [Ping timeout: 256 seconds]
moei has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter> <neutrinog> Greetings. I'm setting up some bindings to a c library and can't figure out how to bind to `char**`. For example I'm binding to this function in c `glutInit( int* pargc, char** argv );` Any pointers? (no pun intended) Here's a gist describing my situation in detail https://gist.github.com/neutrinog/a7c0fe8662f4c2f959fcfa43594ac23d
ashirase has quit [Ping timeout: 272 seconds]
ashirase has joined #crystal-lang
<Groogy> Morning! o/
<FromGitter> <Timbus> @neutrinog looking at the error, it's accessing addr 0. So I guessed you passed the first arg wrong, and the docs for glutInit confirm it.. You have to pass a pointer to argc
Groogy has quit [Read error: Connection reset by peer]
<FromGitter> <Timbus> Ah and you even noted that. Jeez. But you aren't doing it in the crystal binding
Groogy has joined #crystal-lang
return0e has joined #crystal-lang
<FromGitter> <vladfaust> Morning; a 50 rep bounty for this question: https://stackoverflow.com/questions/51903596/how-to-resolve-generics-in-macros
<FromGitter> <j8r> I think not. Why directly typing `Array(Foo::Bar)`
alex`` has joined #crystal-lang
<FromGitter> <vladfaust> @j8r because paths may get really long
<FromGitter> <Qwerp-Derp> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7a9dcde2e48a20b4848efd]
<FromGitter> <Qwerp-Derp> do i just initialise this struct by going `TableModelHandler.new`?
DTZUZO has joined #crystal-lang
<FromGitter> <bararchy> @bcardiff is anyone actually get mails sent to manas@security.com ?
<FromGitter> <bararchy> security@manas.com
<FromGitter> <Qwerp-Derp> Actually, a better question would be how to translate the `TableModelHandler` struct into something like an abstract class
<FromGitter> <j8r> @vladfaust you could create an alias for
<FromGitter> <Qwerp-Derp> Like when they override the function, I can wire it up so that the `TableModelHandler`'s various function variables change
<FromGitter> <Qwerp-Derp> how do I do that?
<FromGitter> <j8r> or put the macro in a module, and include this module into the one with the classes
<FromGitter> <j8r> like https://carc.in/#/r/4s4c
<FromGitter> <vladfaust> @j8r I need full path to be printed
<FromGitter> <j8r> and, what is the use case? This sounds tricky
<FromGitter> <vladfaust> Full paths to models in Core; e.g. a `User` model may be under `MyProject::Models` module and referenced by `Post` model under the same module like `class MyProject::Models::Post; property user : User; end`. This property must be expanded to be used outside afterwards. It can be solved by writing `class MyProject::Models::Post; property user : MyProject::Models::User; end`, but it's a waste of time for a
<FromGitter> ... developer.
<FromGitter> <schoening> Hi, I noticed that when I do not specify the type of a property that *@[JSON::Field(key: "Test")]* has no effect and wont re-name it. How come?
<FromGitter> <asterite> Vlad: replied, there's no way right now
<FromGitter> <asterite> schoening: yeah, I think that's how it works. You can open a bug or feature request, but I'm not sure how it can be implemented, or who will do it
elfryskai has joined #crystal-lang
return0e has quit [Quit: Leaving]
<FromGitter> <Prutheus> Hello. How can I apply a getter to a class variable? >> ⏎ ⏎ ` ⏎ module Foo ⏎ @@var = "123" ... [https://gitter.im/crystal-lang/crystal?at=5b7ad812dd0b74601e33c17b]
<Groogy> class_getter
<FromGitter> <Prutheus> oh thanks
<Groogy> you can find all of those nice helper macros in the object class documentation
<FromGitter> <Prutheus> ok nice to know, thanks
<Groogy> np
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
<FromGitter> <neutrinog> @Timbus thanks *facepalm* can't believe I missed that asterisk. I shouldn't be programming in the middle of the night. lol.
<FromGitter> <sclee15> Do we have any news for pararellism parallelism
<FromGitter> <sclee15> Suppor
druonysus has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<FromGitter> <vladfaust> Thank you @asterite
Yxhuvud has joined #crystal-lang
<Groogy> Anyone else here who live in Stockholm or nearby area?
DTZUZO has quit [Ping timeout: 240 seconds]
druonysus has quit [Ping timeout: 240 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 272 seconds]
Raimondii is now known as Raimondi
<FromGitter> <vladfaust> I got an interesting issue. I'm implementing a versatile ruby-like callbacks system and it's almost working, but. https://carc.in/#/r/4s8z compiles nicely, however uncommenting leads to compile error: https://carc.in/#/r/4s90. That is strange, is it a bug here?
<FromGitter> <straight-shoota> @vladfaust You need to use `super { yield }`
<FromGitter> <straight-shoota> `super(&block)` captures the block and you can no longer call it with `yield` in the next definition
<FromGitter> <vladfaust> I totally don't understand the concept of capturing (even with a help of docs) 😕 However, it does solve the issue. Thanks, mighty @straight-shoota
<FromGitter> <vladfaust> Hm, I expect it to print `[13, 15, 3, 5, 15, 6, 4, 16, 14]` but got `[13, 3, 5, 15, 16, 6, 4, 14]` instead...
<FromGitter> <vladfaust> That's complicated
<FromGitter> <vladfaust> I'm not sure if further `around` definitions should be deeper in the call stack or, in reverse, higher?
<FromGitter> <vladfaust> ```code paste, see link``` ⏎ ⏎ Which `around` do you expect to be deeper in the callstack? [https://gitter.im/crystal-lang/crystal?at=5b7b0f694be56c5918707d0b]
<FromGitter> <vladfaust> I bet on the second one
<FromGitter> <vladfaust> What about child entities? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7b1033ac25fd11b56dc871]
<FromGitter> <rishavs> Hi. Are ECRs built at compile time or run time?
DTZUZO has joined #crystal-lang
<FromGitter> <vladfaust> @rishavs had no exp with ecr yet, but variables within ecr should be replaced with actual values in the runtime, otherwise what's the point of server side rendering
<FromGitter> <rishavs> Thing is that I am currently using heredocs to create string templates which get embedded into my crystal app binary at compile time. But its been a bit cumbersome. I was thinking of using ECR's but I don't want to sacrifice the runtime perf
<FromGitter> <vladfaust> Run simple benchmarks and share your results then :)
<oprypin> rishavs, ecr and most others are compile time
<oprypin> crinja is a good choice for run time
<FromGitter> <vladfaust> Okay, after some googling I understand that further `around` definitions should be deeper in the stack, however children's `around` should be higher in the stack, but that's not possible because in that case *the latest* around has to call `super{ yield }`, unlike earlier ones which use just `yield`. And we cannot know if this particular `around` is the latest in the class.
return0e has quit [Quit: Leaving]
<FromGitter> <straight-shoota> @rishavs ECR is expanded to plain Crystal at compile time. That's the best runtime performance you can reasonably get.
DTZUZO has quit [Ping timeout: 256 seconds]
<FromGitter> <straight-shoota> There should not be any relevant overhead compared to manual string interpolation.
<FromGitter> <rishavs> Is there anyway of using ECRs inside a def? I am getting this error; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7b1a184be56c591870be1e]
<FromGitter> <BrucePerens> Why is this happening with 0.26?
<FromGitter> <BrucePerens> Error in /usr/share/crystal/src/string.cr:139: can't declare variable with Self ⏎ ⏎ include Comparable(self)
<FromGitter> <straight-shoota> @vladfaust A proc is a block stored in a variable. You can pass it around, store it on the heap and whatever. `yield` essentially inlines the block's code directly at codegen. That's why you can only yield if the block is an actual block. A proc can't be inlined because it is just a pointer to some anonymous function and can be changed at runtime.
<FromGitter> <straight-shoota> @BrucePerens see #6547
<FromGitter> <straight-shoota> Fix is already in master
<FromGitter> <vladfaust> @straight-shoota it's impossible to capture a block without implying in and out arguments, right?
<FromGitter> <vladfaust> Thanks for explanation, I understand it better now 🎉
<FromGitter> <paulcsmith> @rishavs you probably want https://crystal-lang.org/api/0.26.0/ECR.html#render%28filename%29-macro
<FromGitter> <BrucePerens> @straight-shoota Thanks! Only fix for the moment is to build crystal from source?
<FromGitter> <rishavs> thanks @paulcsmith
<FromGitter> <paulcsmith> You're welcome
<FromGitter> <straight-shoota> @BrucePerens Yes. Or you can wait for the next nightly build which should be around in a few hours
<FromGitter> <straight-shoota> @vladfaust You can capture blocks without type restriction, this will implicitly be of type `Proc(Nil)`
<FromGitter> <straight-shoota> that's what your `super(block)` did
<FromGitter> <vladfaust> Some mad metaprogramming right there: https://carc.in/#/r/4sac (spoiler: I made it work as described above)
DTZUZU has quit [Quit: WeeChat 1.9]
return0e has joined #crystal-lang
akaiiro has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <vladfaust> The module is now available @ https://github.com/vladfaust/callbacks.cr
<FromGitter> <bcardiff> yes @bararchy :-) sorry we didn't send an ACK. I share it with the core team already.
<FromGitter> <j8r> @rishavs you wish to make a web app, and server html pages? If you want the best performances, you have to put static as much as you can. So, you can serve static html pages and eventually "hydrate" them with an API for the dynamic contents. Another advantage is you can also have different client than web like mobile, desktop apps etc
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 256 seconds]
alex`` has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.2]