ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.0 | 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
postmodern has joined #crystal-lang
<postmodern> why doesn't Digest::Base define abstract methods for #final and #result? https://github.com/crystal-lang/crystal/blob/612825a53c831ce7d17368c8211342b199ca02ff/src/digest/base.cr#L3
<postmodern> hmm how do you define an abstract class method? or is there a crystal equiv to raise(NotImplementedError)?
<oprypin> postmodern, it's literally `abstract def`. it works.
dwdv has quit [Ping timeout: 258 seconds]
<postmodern> oprypin, "abstract def self.pack(crc)"
<postmodern> oprypin, Error: can't define abstract def on metaclass
<oprypin> oh. nvm
<oprypin> yes that's just not a thing, i think
<oprypin> first you need to consider how overriding a class method would work (im not sure if it does)
<postmodern> would be defined by the immediate sub classes
<oprypin> postmodern, no i think there is no inheritance of class methods
<postmodern> hmm that's weird
<postmodern> so they are bound to the class they are defined in?
<oprypin> *nevermind*, it works. just needed some gynastics. https://carc.in/#/r/8mx5
<oprypin> anyway. abstract class methods are still not a thing :s
<postmodern> can survive with making it an instance method
<postmodern> dang spectator doesn't support shared examples
<postmodern> suppose i could roll my own shared example using macros
<oprypin> postmodern, ah FYI compiletime error is a thing https://carc.in/#/r/8mx7
<postmodern> how do you enforce that an ivar is never Nil?
<oprypin> uhhh you declare its type to not include Nil ??
<postmodern> trying to define @crc : UInt8 in a sub-class
<postmodern> Error: instance variable '@crc' of Digest::CRC, with Digest::CRC8 < Digest::CRC, is already declared as (Int32 | Nil) (trying to re-declare as UInt8)
<raz> property block : (-> Nil)?
<raz> ^ is there a way to change this line so that "block" can hold a Proc with any return type/
<raz> i have a feeling it should be possible, but can't figure out a syntax that works. hm.
<oz> raz: what about `property block : (->)?`
<raz> oz: that... just works ¯\_(ツ)_/¯
<raz> thank you
<raz> aaand everything snaps into place
<raz> crystal feels like a downhill battle
<oz> it does sometimes :)
<postmodern> i'm guessing "abstract constants" are not supported?
<raz> don't think so, i've been in situations where i'd have liked them, too
<raz> (but in hindsight they'd probably be a bad idea anyway)
<raz> same for abstract methods btw. almost every time i used them, i'd later revert to a normal method.
<raz> perhaps i just haven't found the proper secret sauce yet, tho
<postmodern> yeah would like to my abstract class have methods that rely on constants that are defined in the sub-classes
<postmodern> suppose the constants can just become abstract instance methods as well
<raz> yep, i think that's what i have done most of the time
<postmodern> are compiler annotations on abstract methods inherited when those methods are defined in the sub-classes?
<postmodern> ex: @[AlwaysInline]... abstract def my_one_liner_method
<raz> no clue, i've never used those
<postmodern> can you pass keyword arguments to a generic class definition, like Foo < Bar(UInt64, other_stuff: "here") ?
<postmodern> what's the quickest way to convert the bytes in a UInt into a String?
teardown has quit [Read error: Connection reset by peer]
<postmodern> wow wait, String#length isn't a thing in crystal?
<postmodern> ah #size
<postmodern> length is pretty common though...
<postmodern> also wow what, Int32 / Int32 returns a Float32? Normally I'd expect that to round to an int
<postmodern> also hmm, doesn't look like you can use macros (sizeof) on a generic type T
<postmodern> or use generic types in a constant assignment
ur5us has quit [Ping timeout: 240 seconds]
<postmodern> BUG: unknown node in TypeLookup: sizeof(UINT) SizeOf (Exception)
<postmodern> i am really giving the type system a workout
<postmodern> how do you define an abstract method which returns a static array of something, but you don't know the exact size yet?
teardown has joined #crystal-lang
ur5us has joined #crystal-lang
dwdv has joined #crystal-lang
<postmodern> is there a crystal equiv of const_get ? i want to request a constant, and have it look at the class of the object, not the class the method was defined in
_ht has joined #crystal-lang
alexander92 has joined #crystal-lang
alexander92 has left #crystal-lang [#crystal-lang]
<postmodern> https://carc.in/#/r/8myw having trouble defining a class property in a base class that uses a generic type
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 248 seconds]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
DTZUZU has quit [Ping timeout: 260 seconds]
_ht has quit [Ping timeout: 246 seconds]
postmodern has quit [Quit: Leaving]
_ht has joined #crystal-lang
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 258 seconds]
HumanGeek has quit [Ping timeout: 255 seconds]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
DTZUZU has joined #crystal-lang
darkstardevx has quit [Remote host closed the connection]
sorcus has quit [Quit: WeeChat 2.7]
sorcus has joined #crystal-lang
renich has joined #crystal-lang
renich has quit [Ping timeout: 272 seconds]
Vexatos has quit [Remote host closed the connection]
Vexatos has joined #crystal-lang
<yxhuvud> postmodern: Use // if you want an int back
<yxhuvud> oh, he left
MasterdonX has quit [Ping timeout: 258 seconds]
MasterdonX has joined #crystal-lang
_whitelogger has joined #crystal-lang
ht_ has joined #crystal-lang
_ht has quit [Ping timeout: 246 seconds]
ht_ is now known as _ht
sagax has quit [Ping timeout: 265 seconds]
sagax has joined #crystal-lang
ur5us has joined #crystal-lang
_ht has quit [Quit: _ht]
postmodern has joined #crystal-lang
<postmodern> hello, i'm trying to define a class variable in a generic class that uses the generic type. crystal kind infer the type though. is this even allowed at the class-level? https://carc.in/#/r/8n3j
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #crystal-lang