<FromGitter>
<galvertez> i can't figure out what `OpenSSL::Cipher.new(name : String)` wants - i tried `openssl ciphers | tr : \\n | while read cipher ; do crystal eval "require \"openssl\"; p OpenSSL::Cipher.new(\"$cipher\")" ; done` and they all failed
<FromGitter>
<Blacksmoke16> how much of a hack is the mutable constant thing?
<FromGitter>
<Blacksmoke16> i.e. using a macro to alter a constant, then. using the constant values in another macro...
<FromGitter>
<Blacksmoke16> thats the only thing coming to mind for something i wanted to do
<FromGitter>
<Blacksmoke16> option*
<FromGitter>
<Blacksmoke16> could use an annotation, but wouldnt be a nice api
<FromGitter>
<watzon> I would like to know as well
<FromGitter>
<watzon> Sometimes it seems like a mutable constant would be the only way to accomplish something
<FromGitter>
<Blacksmoke16> maybe just overusing it is a hack. Annotations are the better approach most of the time
<FromGitter>
<Blacksmoke16> @watzon, yea esp since constants and annotations are the only things that are accessible at compile time
<FromGitter>
<Blacksmoke16> could also run another crystal program, but yea...
<FromGitter>
<Blacksmoke16> to give some context, the, my DI shard supports auto resolving dependencies based on types. This however only works for actual objects, not scalar values ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ec6af543ffa6106f1c6a419]
<FromGitter>
<Blacksmoke16> to give some context, the, my DI shard supports auto resolving dependencies based on types. This however only works for actual objects, not scalar values ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Or something like that. Also could add a third optional argument to scope it to specific types [https://gitter.im/crystal-lang/crystal?at=5ec6af7989941d051a143610]
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
<FromGitter>
<jwoertink> I see that there's a `Union.nilable?` method, but with this `TypeDeclaration` I have, when I call `type_declaration.type.nilable?` I get `undefined macro method 'Union#nilable?'`
<FromGitter>
<jwoertink> so it seems to be calling on an instance?
<FromGitter>
<ErikAGriffin> Hi, I've heard there's a crystal Slack channel but I can't find it. Is anyone able to point me in the right direction?
<FromGitter>
<xmonader> anyone used ishi before? I want to generate png image for a chart? the API internal code seems to have IO object maybe I can dump that on the filesystem as png?
<FromGitter>
<xmonader> but still passing Term.io doesn't work because it is intiialized already to STDOUT :(
HumanG33k has joined #crystal-lang
<FromGitter>
<xmonader> found out!!! ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ looks like i needed to reset the io stream to 0, but this again works when i hardcoded io stream in ishi class instead of STDOUT :) don't know how to change it yet.. [https://gitter.im/crystal-lang/crystal?at=5ec6e21327513a72fba50500]
<FromGitter>
<watzon> Ahh yeah, just use `IO#rewind`
<FromGitter>
<watzon> `StumpyPNG.read(inst.class.io.rewind)` should do it
<FromGitter>
<xmonader> now only the problem of passing the io buffer :(
<FromGitter>
<Blacksmoke16> hm, i think ideally you would define your own png thing to write it to a file
<FromGitter>
<Blacksmoke16> then it would just inherently work when you do `.show`
<FromGitter>
<Blacksmoke16> versus adding this extra io/rewind logic
<FromGitter>
<watzon> Yeah it would be nice if `Ishi::Png` contained a `StumpyPNG::Canvas`. It could export `save` and `buffer` methods to save to a file or return the raw PNG buffer.
<FromGitter>
<Blacksmoke16> if only shards had optional dependencies :p
<FromGitter>
<watzon> Right?
<FromGitter>
<Blacksmoke16> related to that. how would you guys handle this case
<FromGitter>
<Blacksmoke16> you have shard A and shard B
<FromGitter>
<watzon> I wonder, with ysbaddadan stepping way from Crystal is he still going to be maintaining shards?
<FromGitter>
<Blacksmoke16> shard B is an optional dependency to shard A
<FromGitter>
<Blacksmoke16> within shard A you want to define some conditional logic to do something based on the type of a variable
<FromGitter>
<Blacksmoke16> i.e. an included module or something
<FromGitter>
<Blacksmoke16> do you ⏎ 1) just define the module in shard A, so it exists ⏎ 2) create hard C to essentially just hold interfaces that could be used in both A and B
<FromGitter>
<Blacksmoke16> got this idea working from earlier
<FromGitter>
<watzon> Trying to think about how I could make use of this with Tourmaline
<FromGitter>
<Blacksmoke16> probably would be possible? if it would be a good use case would depend on the API you want to have and how its architectured currently
<FromGitter>
<Blacksmoke16> I find it neat, but that doesnt mean every project needs it
<FromGitter>
<watzon> The main thing I could see it working for is context handling, but idk if it will work for that
<FromGitter>
<watzon> I'm wondering if DI could help that situation
<FromGitter>
<Blacksmoke16> hmm, im thinking not really
<FromGitter>
<Blacksmoke16> DI is mainly for abstracting/managing dependencies of various types aka services. So like you say you have a `UrlUtils` type, that is instantiated with the current env's base URL, you can then inject this service into other things that need it
<FromGitter>
<Blacksmoke16> given in this case it looks like you just have a struct to hold data, that gets passed around