ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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: 246 seconds]
<FromGitter> <oprypin:matrix.org> @mattrberry: `macro foo(num); {{num}}.as(Int32)`
<FromGitter> <mattrberry> That was just a random example of โ€œ1โ€ vs 1 :p Really, I just want a way to constrain the types that the macro is called with :p
<FromGitter> <Blacksmoke16> @bcardiff just a heads up, the API docs haven't been added to GH assets for `0.36.0` and `0.36.1`
<FromGitter> <Blacksmoke16> some automated thing prob broke
_whitelogger has joined #crystal-lang
<FromGitter> <Where_Is_X_twitter> oops. thanks @Blacksmoke16 !
_whitelogger has joined #crystal-lang
<deimos_> where does one hire crystal-lang people?
<deimos_> say i wanted to convert a rails app into crystal
<FromGitter> <Blacksmoke16> could try the forums
<deimos_> upwork/toptal points me at crystal reports
<deimos_> ;)
<FromGitter> <Blacksmoke16> know what framework you going to port it to? ๐Ÿ˜‰
aquijoule__ has joined #crystal-lang
aquijoule_ has quit [Ping timeout: 265 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 258 seconds]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
<deimos_> preferably, none to minimal, imho
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Daniel-Worrall> There was a crystaljobs site, but it's down.
<FromGitter> <Daniel-Worrall> You could the forums, here, the discord
<FromGitter> <Daniel-Worrall> for what it's worth, I'm open for employment but I lack rails experience
<deimos_> probably to your benefit...;)
<FromGitter> <Daniel-Worrall> heh, searching crystal on upwork just gets me people called Crystal
jrayhawk_ is now known as jrayhawk
<FromGitter> <naqvis> @Daniel-Worrall ๐Ÿ˜†
<FromGitter> <mattrberry> @Blacksmoke16 I think I got something like what I want working :) https://carc.in/#/r/acz6
_ht has joined #crystal-lang
MasterdonX has joined #crystal-lang
<FromGitter> <mattrberry> What's the practical difference between `Nil` and `Void`? Specifically, should there be any difference between `Proc(Nil)` and `Proc(Void)`? I'm guessing that `Void` is just meant to be used for typing in c-bindings, but I assumed that it was effectively an alias for `Nil` otherwise?
<FromGitter> <mattrberry> Looking at issues on github, my assumption that `Void` is really only meant for c bindings seems correct. I also see a comment from Ary that says "Nil and Void are synonyms" though, which is a little confusing. Even though we shouldn't use Void outside of bindings, I wouldn't expect it to cause issues. I see that Julien also left a comment on the forum last month asking if we could restrict the use of `Void`
<FromGitter> ... outside of bindings
<FromGitter> <mattrberry> For a specific example of the problem I'm having, here's a place that I use `Proc(Void)`: https://github.com/mattrberry/crab/blob/master/src/crab/scheduler.cr#L14-L22 โŽ I've been doing this for awhile, and it's effectively the same code I use for the Scheduler in CryBoy as well. โŽ I just made some changes to the emulator, but nothing that interacts differently with c-bindings, and nothing to do with the
<FromGitter> ... scheduler. All of a sudden, this call started segfaulting: https://github.com/mattrberry/crab/blob/master/src/crab/scheduler.cr#L54 โŽ It never got into the proc that it was intended to call into, seemingly segfaulting on the call: โŽ ... [https://gitter.im/crystal-lang/crystal?at=601d01b70eed905f189369c2]
MasterdonX has quit [K-Lined]
flaviodesousa has joined #crystal-lang
flaviodesousa has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
<FromGitter> <Uzay-G> sorry I kinda got distracted and didn't tell you how it went, but your idea of directly using IO worked @Blacksmoke16
<FromGitter> <Uzay-G> thanks a bunch!
<FromGitter> <Uzay-G> now it's writing that's becoming a pain ๐Ÿ˜‚
<FromGitter> <Uzay-G> ^ very slow ๐Ÿ˜…
<FromGitter> <Uzay-G> if I have a `Hash(String, Hash(String, <Custom Object>))`
<FromGitter> <Uzay-G> is the most efficient way to dump it to a file just to iterate through all the values?
<FromGitter> <Uzay-G> alright I think I fixed it again
<FromGitter> <Uzay-G> wow directly calling IO is so much faster !
<FromGitter> <asterite> @mattrberry it would be great if you could reduce the code so we can see why it's crashing. But no need to do it if it's a lot of work
<FromGitter> <Blacksmoke16> @Uzay-G yea using IOs is almost always the better way to handle reading/writing files
<FromGitter> <Blacksmoke16> Just released Athena `0.13.0`
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <djberg96> noob here, still learning, is there any downside to doing `include Comparable(self)` instead of `include Comparable(SomeClassName)` in typical cases?
<FromGitter> <Blacksmoke16> not really afaik
<straight-shoota> No, it means the same
<FromGitter> <djberg96> ok, thanks
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter> <mattrberry> @asterite I truly have no idea if I could minimize it since Iโ€™ve had Proc(Void) for months without issue, unfortunately. It only started becoming a problem yesterday with my newest changes. Iโ€™m happy to push the current state to a branch if you like, though. Not sure how helpful thatโ€™d be
<FromGitter> <asterite> @djberg96 if you use `self` and you have types that inherit `SomeClassName`, types in different places of the hierarchy won't be comparable
<FromGitter> <asterite> @mattrberry Yeah, I could debug it if I had time, but I don't. Also if it works with Nil then then there's less pressure to fix it
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter> <djberg96> @asterite Not sure I follow, I tried this: https://gist.github.com/djberg96/fcbff4c0d0651209a932e6872121bb0b
<FromGitter> <djberg96> Can you give me an example of what you mean?
deavmi has joined #crystal-lang
<FromGitter> <mattrberry> @asterite Iโ€™ll push it to a branch for you to check out if you ever have time or if youโ€™re curious. As you said, not a blocker for me atm since I can just use Proc(Nil). In the meantime, is there any reason we shouldnโ€™t prohibit use of Void outside of c-bindings?
ua has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
<FromGitter> <wyhaines> Anyone around who has tinkered with Lucky? I'm playing with it. I've done all of the basic install according to the web site, and wired it up to a fresh, empty db. On running the script/setup, though, it throws an error:
<FromGitter> <wyhaines> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=601d8cb5ae4b9b27c1a0a9f3]
deavmi has quit [Ping timeout: 265 seconds]
alexherbo2 has joined #crystal-lang
deavmi has joined #crystal-lang
alexherbo23 has joined #crystal-lang
<FromGitter> <Blacksmoke16> traitor :P. I'd maybe try their gitter/discord. People there would prob be more familiar
deavmi has quit [Ping timeout: 272 seconds]
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo23 is now known as alexherbo2
<FromGitter> <wyhaines> Hahaha. I'm just tinkering and exploring the ecosystem. And yeah, seems that they have moved from gitter to discord. :)
deavmi has joined #crystal-lang
<FromGitter> <Blacksmoke16> all good :P
<FromGitter> <asterite> @djberg96 Try with another subtype, `Baz`, and comparing `Bar` with `Baz`. It won't compile with `self`, it will compile with `Foo`
<FromGitter> <asterite> @mattrberry because you have to interact with C code, Void can leak outside of C libs so it's hard to restrict that
gangstacat has quit [Ping timeout: 272 seconds]
<FromGitter> <watzon> Ok I think I know why this isn't working, but how would I get similar behavior to what I'm looking for here? https://carc.in/#/r/ad2h/edit
<FromGitter> <watzon> I know I've seen something like this done before, probably in something that @Blacksmoke16 wrote
<FromGitter> <djberg96> ha, you can use a splat operator in a require statement in Crystal. I remember the Ruby community hated that suggestion, but I don't remember why now.
<FromGitter> <watzon> Yeah I don't get the Ruby methodology. You have require, require_relative, autoload, and a couple other ways to load things. In Crystal it's simple: require without a relative path will search your installed shards in `lib` and with a relative path will search along that path.
<FromGitter> <watzon> Globbing support is definitely nice as weoo
_ht has quit [Remote host closed the connection]
<FromGitter> <djberg96> I know it lead to gems like this: https://github.com/jarmo/require_all (which I think was borrowed from Merb)
<FromGitter> <djberg96> There was an RCR for it at one point, but I can't find it, or the reasons Matz rejected it
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
deavmi has quit [Quit: Eish! Load shedding.]
<FromGitter> <Blacksmoke16> @mattrberry nice one!
<FromGitter> <djberg96> of course, as i try to use it, it's failing: http://media.pragprog.com/titles/crystal/code/advanced_features/crchinook/src/crchinook.cr
<FromGitter> <djberg96> books says do `crystal build src/crchinook.cr`, but I get `Error: can't find file './crchinook/*' relative to '/Users/dberger/Programming/Crystal/crchinook/src/crchinook.cr'`
<FromGitter> <Blacksmoke16> just require extra files one at a time
<FromGitter> <Blacksmoke16> using glob like that is kinda meh most of the time
<FromGitter> <djberg96> ok :)
<FromGitter> <Blacksmoke16> figure it out @watzon ?
<FromGitter> <watzon> Nope, not even kinda
<FromGitter> <watzon> Did you ever have any luck with that @Blacksmoke16?
<FromGitter> <Blacksmoke16> well for one thing its `macro finished` not `macro finalized`
<FromGitter> <Blacksmoke16> related, may i interest you in https://athenaframework.org/EventDispatcher/? :P
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<oprypin> is there any good way to call a class method of the current class without naming that class? note: i'm looking for "everyday use", not macros
<FromGitter> <Blacksmoke16> `self.class.my_method`
<oprypin> `typeof(self).my_method` would be faster then, i guess? i do wonder why those methods aren't "just" accessible
<FromGitter> <Blacksmoke16> `{{@type}}.my_method` would prob work too
<straight-shoota> I wouldn't expect much performance difference between any of them
<straight-shoota> they're just different names for the same thing
<straight-shoota> I typically use `self.class` because it's the simplest option
<FromGitter> <watzon> Haha EventHandler was just an example
<FromGitter> <djberg96> looking at https://shardbox.org/shards/posix, not sure i understand how to use it
<FromGitter> <djberg96> was just going to try a simple uname interface
<oprypin> lol i have a macro that first has some huge compiletime logic without printing anything, and at the end it produces the output
<oprypin> really enjoying the 1672 empty lines printed first on any error
<FromGitter> <watzon> I hate that enough that I usually just go ahead and write all of my macros with a trailing backslash
<oprypin> please tell me more
<FromGitter> <watzon> ```{% if foo %}\ โŽ # do something... โŽ {% end %}\``` [https://gitter.im/crystal-lang/crystal?at=601dc5a69238c531ad2914a8]
<oprypin> ok i see thanks
<FromGitter> <watzon> It will limit the number of newlines you end up generating big time
<straight-shoota> we talked about that a few days ago... macro debug output should be passed through the formatter to make it presentable
<FromGitter> <djberg96> hand rolling it, making progress: https://gist.github.com/djberg96/c4ae2a5e11a9a741f1921c394fa16ce1
<FromGitter> <djberg96> i get a struct with data in it, i'm just not sure how to unroll it
<oprypin> wow i found that adding a backslash at **every single `%}\n`** gives the best result
<oprypin> dont even need to check
<oprypin> i have a module with `macro finished` and when i include it on something, the immediate expansion doesn't see any {{@type.methods}}, it sees them only if i do `include MyModule` at the very end. what am i doing wrong?
<straight-shoota> instance methods are not available in finished hook because you can define additional methods there
<straight-shoota> {{@type.methods}} only works in a method
<straight-shoota> so you can call a method in the hook to do what you want
<oprypin> but i dont wanna lol
<oprypin> oh as i was making the repro https://carc.in/#/r/ad5k i realized it myself, it should be https://carc.in/#/r/ad5l
<FromGitter> <Blacksmoke16> not sure, `@type.instance_vars` only works in a method
<FromGitter> <Blacksmoke16> true*
<FromGitter> <Blacksmoke16> 99% sure `@type.methods` works anywhere
<straight-shoota> eh yeah
<straight-shoota> mixed that up