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
pixel1 has quit [Ping timeout: 252 seconds]
xybre has quit [Ping timeout: 252 seconds]
markmarkmark has quit [Ping timeout: 252 seconds]
riza has quit [Ping timeout: 252 seconds]
<FromGitter> <mattrberry> ```a = 1 ⏎ puts typeof(a) ⏎ spawn { a = "string" }``` ⏎ ⏎ This example prints `(Int32 | String)`. I don't know much about crystal fibers. I figure the compiler *could* track that the main fiber never yields here so the spawned channel will never run. I'm guessing that's just not worth the overhead of tracking at compile-time for silly examples like this? [http
<FromGitter> ... s://gitter.im/crystal-lang/crystal?at=62a7df90deea5616bbf77366]
<FromGitter> <Blacksmoke16> Is it because it creates a closure
<FromGitter> <Blacksmoke16> Like try it with a proc that you don't call
<FromGitter> <mattrberry> Yeah that's surprising too
pixel1 has joined #crystal-lang
<FromGitter> <mattrberry> I imagine typeof(a) should print Int32 since there's no way for it to be a string at that point
xybre has joined #crystal-lang
<FromGitter> <mattrberry> It behaves the same way as above with a proc, as you suggested
riza has joined #crystal-lang
<FromGitter> <mattrberry> I'll open a github issue just to gather thoughts
markmarkmark has joined #crystal-lang
<FromGitter> <naqvis> `typeof` is a runtime thing, if you need compile time value, use `puts a.class` instead.
<FromGitter> <Blacksmoke16> It's the opposite ^
<FromGitter> <naqvis> https://carc.in/#/r/db35
<FromGitter> <Blacksmoke16> Right, at runtime it knows it's a number
<FromGitter> <naqvis> aahh, gotcha
<FromGitter> <naqvis> `typeof` is a pseudo-method
<FromGitter> <Blacksmoke16> Ye
<FromGitter> <naqvis> 🌹
<FromGitter> <mattrberry> I'd like to make a unique Bytes-like type that adds some additional methods. Is that possible? For example, I'd like to have a Slice(UInt8) that adds a method to interpret the first few bytes a certain way
<FromGitter> <naqvis> You can wrap Bytes inside your custom class
<FromGitter> <naqvis> and delegate bytes related methods to bytes obj you wrapped
<FromGitter> <mattrberry> Thanks, that's what I just did 👍
<FromGitter> <naqvis> 👍
jmd_ has quit [Ping timeout: 244 seconds]
ur5us has quit [Ping timeout: 255 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 255 seconds]
ur5us has joined #crystal-lang
MariaElis[m] has quit [Quit: You have been kicked for being idle]
ur5us has quit [Ping timeout: 250 seconds]
ua_ has quit [Ping timeout: 240 seconds]
ua_ has joined #crystal-lang
onyx has joined #crystal-lang
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp has joined #crystal-lang
Sankalp has quit [Ping timeout: 248 seconds]
Sankalp has joined #crystal-lang
hexology- has joined #crystal-lang
hexology has quit [Quit: hex on you ...]
analogsalad has joined #crystal-lang
_ht has joined #crystal-lang
renich has joined #crystal-lang
fifr has joined #crystal-lang
_ht_ has joined #crystal-lang
<renich> @Blacksmoke16: man Chapter 3 has an error in the Location struct for the building instance. It says 'p store' at the end. I think you meant 'p building'. Page 84 in the pdf.
<FromGitter> <Blacksmoke16> 😱
_ht has quit [*.net *.split]
ua_ has quit [*.net *.split]
HumanG33k has quit [*.net *.split]
fifr_ has quit [*.net *.split]
HumanG33k has joined #crystal-lang
ua_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> That was one of @lbguilherme's chapters. Not sure how they handle edits tho?
<renich> @Blacksmoke16: OK, just wanted to report it.
<FromGitter> <Blacksmoke16> 👍 thnaks
<analogsalad> Blacksmoke16: Probably here? https://www.packtpub.com/submiterrata
<FromGitter> <Blacksmoke16> oh perfect yea
<analogsalad> I was wondering why I haven't noticed it, turns out I'm on page 81- 3 more pages to go.
<analogsalad> Though I do have a note from that chapter I want to run by you.
<FromGitter> <Blacksmoke16> not super familiar with the specifics of it, but ill do what i can
<analogsalad> There's an example where a class is reopened to add a new method. It's said "when reopening a class, it's parent class should not be specified."
<analogsalad> This made me think that specifying the parent class would cause a compiler error, rather than it's just redudant.
<analogsalad> *redundant.
<FromGitter> <Blacksmoke16> it might just be to prevent issues with changes in the hierarchy of that type
<FromGitter> <Blacksmoke16> i.e. some refactoring goes on and the parent type changes, then you'd get a compile error
<FromGitter> <Blacksmoke16> granted that assumes that happened in a way that didnt also break what you were overriding
<analogsalad> That's a good point.
SamantazFox has quit [Killed (NickServ (GHOST command used by SamantazFox_))]
SamantazFox_ has joined #crystal-lang
brw3 has joined #crystal-lang
adam128 has joined #crystal-lang
dostoyev1ky2 has joined #crystal-lang
dostoyev1ky2 has quit [Client Quit]
dostoyev1ky2 has joined #crystal-lang
brw has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
adam12 has quit [*.net *.split]
dom96 has quit [*.net *.split]
brw3 is now known as brw
dom96 has joined #crystal-lang
dostoyev1ky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
adam128 is now known as adam12
jmdaemon has joined #crystal-lang
_ht_ has quit [Remote host closed the connection]
analogsalad has quit [Quit: bye]
ur5us has joined #crystal-lang
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
oprypin has quit [Ping timeout: 248 seconds]
oprypin has joined #crystal-lang
renich has quit [Remote host closed the connection]
renich has joined #crystal-lang