<rocx>
b'guh. wasn't there an update not too long ago that said the compiler could "downgrade" integer types (eg. turning `3` into a `UInt8` if i declared the type to be such?
<FromGitter>
<Blacksmoke16> in some cases yea
<rocx>
urgh. i decide to use UInt8s just to save a smidge of memory and turns out it's a lot of type annotating and .to_u8 calls.
<FromGitter>
<Blacksmoke16> unless you have a reason to do it, better to just use Int32
<rocx>
shaving a whole three bytes per integer but that might just be munchkining on memory.
<FromGitter>
<Blacksmoke16> benchmark it and find out
<FromGitter>
<Blacksmoke16> otherwise its just premature optmization
<rocx>
and we all know premature optimization is the root of all evil.
<FromGitter>
<moe:busyloop.net> crystal tries to help you resist the munchkining, by making it annoying
<rocx>
fair. then again, having a type system like this be annoying before running the code would have saved me the months of all the jira tickets saying "unexpected method for NilClass".
<FromGitter>
<Blacksmoke16> there's also a compile time flag you can use to make it more strict
<FromGitter>
<Blacksmoke16> allows it to autocast number literals, but not expressions
<FromGitter>
<Blacksmoke16> e.g. `foo 10` would work but not `foo 5 +5`
<FromGitter>
<moe:busyloop.net> ah yea, good ol' masochist mode
<FromGitter>
<moe:busyloop.net> for next april we should add a go-lang mode that forces you to put `if err` after each line :p
* rocx
shudders
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
Sankalp- has joined #crystal-lang
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp- is now known as Sankalp
ur5us has quit [Ping timeout: 260 seconds]
jmd_ has quit [Ping timeout: 265 seconds]
Sankalp has quit [Ping timeout: 265 seconds]
Sankalp has joined #crystal-lang
_ht has joined #crystal-lang
_ht has quit [Quit: _ht]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
bittin_ has joined #crystal-lang
bittin_ has quit [Ping timeout: 260 seconds]
jmdaemon has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
_ht has joined #crystal-lang
<FromGitter>
<azurelmao> I've come across a weird issue. I'm using the Crystal IDE plugin for IntelliJ and the run command works fine
<FromGitter>
<azurelmao> But when I tried to run it in the terminal, it doesn't
<FromGitter>
<azurelmao> says it can't find a required file, and that i should chrck whether im running the compiler in the same directory as my shard.yml
<FromGitter>
<azurelmao> which I am
ur5us has joined #crystal-lang
_ht has quit [Quit: _ht]
<FromGitter>
<Blacksmoke16> whats the exact error?
<FromGitter>
<plambert> Is it possible to write a module Foo, such that it can wrap the initialize() methods of any class that includes it?
<FromGitter>
<plambert> Basically, I want my "singleton" module to make sure every initialize method ends (or starts) with `@@singleton ||= self`
<FromGitter>
<plambert> I think I could do it by re-implementing `new`, since there's only one of those… but it seemed like there should be a way to do it to the initialize methods themselves…
<FromGitter>
<plambert> (This is a learning project, so while I'm happy to hear of better ways to do this, or of existing shards I could use, I also still want to figure out if it's possible to do this…) :)
<FromGitter>
<Blacksmoke16> try something like
<FromGitter>
<plambert> I'm trying to extract the singleton parts of that class into a module, since I'll be doing all the same things to many classes in this project. And it's all easy, except the `@@singleton ||= self`