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
<FromGitter> <mattrberry> I have cases where it's useful to have an enum of a larger UInt32 type even if it only represents numbers up to 31
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <Blacksmoke16> if you dont customize the values could you do something with just the amount of constants?
<FromGitter> <mattrberry> `sizeof(MyEnum)` just returns the size of the underlying int type, right? Can you call that in a macro anyway?
<FromGitter> <Blacksmoke16> idt
<FromGitter> <mattrberry> Yeah that was my first thought, but I have a few cases like this :/ ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=630ff6d8458f823ce05f6811]
<FromGitter> <Blacksmoke16> rip
<FromGitter> <mattrberry> If I could just do a `while` loop or have a `break` in my macro, I'd be set haha
<FromGitter> <mattrberry> Ooh can I return early from a macro? I'm guessing not?
<FromGitter> <Blacksmoke16> dont think so
<FromGitter> <Blacksmoke16> would love if someone got a PoC working for that. would be *sooo* helpful
<FromGitter> <mattrberry> The first issue you sent gave me an idea
<FromGitter> <mattrberry> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=630ff9d3b16e8236e35649d9]
<FromGitter> <mattrberry> I hate it but it works lol
<FromGitter> <mattrberry> Also, that syntax for macros is new to me. I didn't realize that was valid. Makes writing macros a lot shorter..
ur5us has joined #crystal-lang
<FromGitter> <mattrberry> lol... ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=630ffdaf9994996293425e2e]
<FromGitter> <mattrberry> Just increments off of the last value I guess..
ur5us has quit [Quit: Leaving]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 255 seconds]
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp- has joined #crystal-lang
Sankalp- is now known as Sankalp
<FromGitter> <azurelmao> Sankalp: Ok, so the reason why bar.as(Bar) was returning (Bar | Nil) was because of the unless statement. This snippet works: https://play.crystal-lang.org/#/r/dp5a
kiwiroy has quit [Ping timeout: 268 seconds]
kiwiroy has joined #crystal-lang
<FromGitter> <Blacksmoke16> i feel like there's a better way to do what you're doing
<FromGitter> <Blacksmoke16> @azurelmao is the goal to just have a singleton type that's lazily initialized?
<Sankalp> @azurelmao cool, you can even lose the `return`s https://play.crystal-lang.org/#/r/dp95
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ tada? [https://gitter.im/crystal-lang/crystal?at=6310c093cf6cfd27af6a71c6]
<Sankalp> @Blacksmoke16 it gives error while trying to access `bar` https://play.crystal-lang.org/#/r/dp9a
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ fixed [https://gitter.im/crystal-lang/crystal?at=6310c1e46837563d1cb29dad]
<Sankalp> Works now!
<FromGitter> <Blacksmoke16> 👍
_ht has joined #crystal-lang
hightower2 has joined #crystal-lang
hightower2 has quit [Remote host closed the connection]
<FromGitter> <azurelmao> Wow, this is much cleaner!
<FromGitter> <azurelmao> Thanks!
<FromGitter> <Blacksmoke16> np
_ht has quit [Quit: _ht]
<FromGitter> <azurelmao> Is there a cleaner way to do this? Preferably so that I can just plop Player as the first argument and not *this* https://carc.in/#/r/dpbw
<FromGitter> <Blacksmoke16> can you not have it just accept `Player`?
<FromGitter> <Blacksmoke16> and not a proc
<FromGitter> <azurelmao> Nah I can't. I want to be able to create multiple vars, which would require the the instance var to be generic smth like Class and that isn't possible
<FromGitter> <azurelmao> https://carc.in/#/r/dpc6
ur5us has joined #crystal-lang
<FromGitter> <Blacksmoke16> no i mean an instance of `Player`
<FromGitter> <Blacksmoke16> https://carc.in/#/r/dpce tada?
tsujp_ has joined #crystal-lang
fifr has joined #crystal-lang
jrayhawk_ has joined #crystal-lang
jhass- has joined #crystal-lang
jhass has quit [Ping timeout: 244 seconds]
tsujp has quit [Ping timeout: 244 seconds]
dom96 has quit [Ping timeout: 244 seconds]
jrayhawk has quit [Ping timeout: 244 seconds]
acoolstraw has quit [Ping timeout: 244 seconds]
mikko has quit [Ping timeout: 244 seconds]
fifr_ has quit [Ping timeout: 244 seconds]
jhass- is now known as jhass
tsujp_ is now known as tsujp
dom96 has joined #crystal-lang
mikko has joined #crystal-lang
mikko has quit [Changing host]
mikko has joined #crystal-lang
jrayhawk_ is now known as jrayhawk