<FromGitter>
<RespiteSage> Is there a `previous_def` for class methods? I'm trying to override `Enum.parse` for a particular enum, but only to parse more values than the default, so I don't want to duplicate it.
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
<FromGitter>
<naqvis> no, you can't override class methods
<FromGitter>
<naqvis> `previous_def` works on class methods as well
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
notzmv has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
xyhuvud has joined #crystal-lang
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
hightower2 has joined #crystal-lang
yxhuvud has joined #crystal-lang
xyhuvud has quit [Ping timeout: 250 seconds]
xyhuvud has joined #crystal-lang
yxhuvud has quit [Ping timeout: 240 seconds]
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
avane has quit [Ping timeout: 240 seconds]
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
avane has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
f1refly has joined #crystal-lang
sorcus has quit [Quit: WeeChat 3.4]
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
sorcus has joined #crystal-lang
HumanG33k has quit [Ping timeout: 268 seconds]
HumanG33k has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 268 seconds]
ur5us has joined #crystal-lang
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
Guest21 has joined #crystal-lang
<Guest21>
hello all. I have a question about macros. I am wanting to replace the string in my code with its integer object hash equivelent, but I cant seem to figure out how to apply the method properly. Here is a example of what I am doing and where I want to apply the hash: https://play.crystal-lang.org/#/r/cnha
<Guest21>
furthermore I would like to supply the crystal hasher with my own seed values for a specific purpose, so i dont think i can use any macro builtin for obtaining the hash of the object unless i can specify the hasher like i can with "a".hash(hasher).result where hasher = Crystal::Hasher(seed, seed)
<FromGitter>
<Blacksmoke16> i dont see the point
<FromGitter>
<Blacksmoke16> the value of your constants are already Int
<FromGitter>
<Blacksmoke16> so just use the constant as both the key/value? but by then whats the point?
<Guest21>
this is a reduced code example, there is much more happening that would confuse the code snippet
<Guest21>
aka minimal example of the macro
<Guest21>
i think the way to make this happen would be to use the run() macro expression passing the constants name as a string as well as the seed i want to use, then return the hash integer from the external script. but that seems a bit round about. i was hoping i could call .hash(hasher) on the macroid or something similar
<Guest21>
sorry, i specificcally wanted to replace {{const.stringify.downcase }} with its hash id at compile time, rather than using the stringify'd string of the constants name
<FromGitter>
<Blacksmoke16> dont think that method exists on the ASTNode
<Guest21>
yea, i took a quick look and didnt see anything like it either. wanted to see if anyone else had any clues
<Guest21>
actually looks like running .hash on the stringify is what i wanted to do. thanks blacksmoke16
Guest21 has quit [Quit: Client closed]
<FromGitter>
<straight-shoota> Idk about that, how they do it. The thing is, Crystal doesn't do these optimizations, LLVM does. The Crystal compiler just passes everything to LLVM.