RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.1 | 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
<FromGitter> <Blacksmoke16> maybe ill make a `None` type....be better if you could do like `module MyModule(T = Nil)`, default generic types
<FromGitter> <dscottboggs_gitlab> Ok so here's an actual use case that will get me to switch to CRSerializer right now. ⏎ ⏎ I want to have a YAML config file like ⏎ ⏎ ```notifiers:``` [https://gitter.im/crystal-lang/crystal?at=5cb910576a84d76ed8b856cc]
<FromGitter> <Blacksmoke16> 👀
<FromGitter> <dscottboggs_gitlab> hate when I hit enter instead of shift-enter
<FromGitter> <Blacksmoke16> pro tip, far right of screen, hit `switch to compose mode`
<FromGitter> <Blacksmoke16> requires ctrl+enter to send
<FromGitter> <dscottboggs_gitlab> i did that right after sending the message prematurely :p haha
<FromGitter> <Blacksmoke16> :P
<FromGitter> <Blacksmoke16> also TIL you cant assign a constant `nil` or `""`?
<FromGitter> <Blacksmoke16> oh, it was a name conflict with `NONE = nil`
<FromGitter> <Blacksmoke16> no not, ⏎ ⏎ ```invalid constant value ⏎ ⏎ SDFDSDSF = nil``` ⏎ ⏎ hmm [https://gitter.im/crystal-lang/crystal?at=5cb911a0a4ef097471c04422]
<FromGitter> <dscottboggs_gitlab> Ok so here's an actual use case that will get me to switch to CRSerializer right now. ⏎ ⏎ I want to have a YAML config file like ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5cb911d4a4ef097471c045b5]
<FromGitter> <Blacksmoke16> you can have spaces in yaml keys?
<FromGitter> <dscottboggs_gitlab> yup
<FromGitter> <dscottboggs_gitlab> (I think)??
<FromGitter> <Blacksmoke16> well i mean do realize CrSerializer is basic just stdlib++
<FromGitter> <Blacksmoke16> just adds some features, not really its own thing
<FromGitter> <dscottboggs_gitlab> yeah... so no way to specify a type based on another key?
<FromGitter> <Blacksmoke16> so you would want ⏎ ⏎ ``` kind: telegram ⏎ options: ⏎ chat id: asdlfkn ⏎ api key: ljopijwne``` ⏎ ⏎ to new up a like `Telegram` class, while the `email` kind would new up a `Email` class? [https://gitter.im/crystal-lang/crystal?at=5cb91263e416b84519a17800]
<FromGitter> <Blacksmoke16> dependent on what they key is?
<FromGitter> <dscottboggs_gitlab> yes exactlyu
<FromGitter> <Blacksmoke16> let me try something
* FromGitter * dscottboggs_gitlab is tentatively excited to not have to deal with `YAML::Node`/`YAML::Context`
<FromGitter> <Blacksmoke16> :S
<FromGitter> <Blacksmoke16> the options are also dependent on the kind?
<FromGitter> <Blacksmoke16> are all of the kinds known?
<FromGitter> <dscottboggs_gitlab> the `options` key is known and all potential values of `kind` will be known at compile time
<FromGitter> <Blacksmoke16> perfect
<FromGitter> <dscottboggs_gitlab> it's meant to be extensible at compile time but not runtime, for efficiency's sake
<FromGitter> <Blacksmoke16> are there any options that are shared between kinds?
<FromGitter> <dscottboggs_gitlab> it's just the stuff *under* the `options` key that isn't known.
<FromGitter> <dscottboggs_gitlab> I don't think that will necessarily be the case
<FromGitter> <dscottboggs_gitlab> but again, all keys are known at compile time
<FromGitter> <Blacksmoke16> oh know key/values under `options` are dynamic?
<FromGitter> <Blacksmoke16> and not known at compile time?
<FromGitter> <dscottboggs_gitlab> no they're known at compile time but I want to make them able to be anything, so that extensions can easily be written for other notifiers
<FromGitter> <dscottboggs_gitlab> the notifier just has to implement the `kind` and `options` properties (deserializing etc) and two other methods, but the current implementation of the `options` key is much less than ideal and I don't even know how to do it in YAML+crystal
shmibs has quit [Quit: leaving =o]
shmibs has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6r15 well thats a start?
<FromGitter> <Blacksmoke16> but if the keys of `options` are known, you could create classes for each one like
<FromGitter> <dscottboggs_gitlab> yeah I thought about just making `options` a hash, but I wanted to allow it to be any struct.
<FromGitter> <dscottboggs_gitlab> yes, all the keys of options are known at compile time -- to add more types you'd need to recompile
<FromGitter> <Blacksmoke16> rgr
<FromGitter> <dscottboggs_gitlab> you don't have to solve all my problems for me ;) I was just wondering if your library already had a solution
<FromGitter> <Blacksmoke16> its an interesting challenge
<FromGitter> <Blacksmoke16> you could get close i think
<FromGitter> <dscottboggs_gitlab> yup. it's not too hard in JSON if you just throw an exception if `kind` isn't first in the file... but YAML::PullParser is a bit lacking...
<FromGitter> <dscottboggs_gitlab> specifically the `#read_mapping` overload with a block that yields the key...
<FromGitter> <Blacksmoke16> yea im hitting some compiler bug
<FromGitter> <dscottboggs_gitlab> oh that's nice lol
<FromGitter> <Blacksmoke16> i have an idea
<FromGitter> <Blacksmoke16> naw
<FromGitter> <dscottboggs_gitlab> damn
<FromGitter> <dscottboggs_gitlab> oh well
<FromGitter> <dscottboggs_gitlab> k
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> id vote its doable, but generic/inheritance sys isnt good enough
<FromGitter> <Blacksmoke16> to do it automagically
laaron has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> yeah, that's fair.
<FromGitter> <Blacksmoke16> is the main thing you care about is each kind has its own `options` object vs a hash?
<FromGitter> <dscottboggs_gitlab> that's the idea. I might just have to go with a hash though
<FromGitter> <Blacksmoke16> that might be more doable
<FromGitter> <dscottboggs_gitlab> but like even a hash wouldn't be ideal, because then it has to be a specifically-typed hash, and what if one of the options needs a nested option or an array?
<FromGitter> <dscottboggs_gitlab> then you've got people parsing URL-encoded JSON out of a YAML-encoded string and it's just a mess
<FromGitter> <Blacksmoke16> let me try something
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6r2q going to have the unmapped stuff handing around tho
<FromGitter> <Blacksmoke16> er
<FromGitter> <Blacksmoke16> meh i give up
<FromGitter> <Blacksmoke16> sorry due
<FromGitter> <Blacksmoke16> more of a `YAML::Serializable` limitation
<FromGitter> <dscottboggs_gitlab> yup
<FromGitter> <dscottboggs_gitlab> thanks for trying
<FromGitter> <Blacksmoke16> imo id rather just deal with the validations
<FromGitter> <dscottboggs_gitlab> hm?
<FromGitter> <dscottboggs_gitlab> just use YAML.parse?
<FromGitter> <Blacksmoke16> the validations that happen on deserialize
<FromGitter> <dscottboggs_gitlab> I see what you mea
<FromGitter> <Blacksmoke16> for working with JSON APIs, allows you to read values in like on POST, but exclude them on read
<FromGitter> <Blacksmoke16> ye
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab you on `0.28.0` yet?
<FromGitter> <dscottboggs_gitlab> I thought it wasn't out yet! haha
<FromGitter> <Blacksmoke16> xD yea its out now
<FromGitter> <Blacksmoke16> trying to figure out why i cant assign `nil` to a constant...
<FromGitter> <dscottboggs_gitlab> it's ready so I will be next time I go to compile something 😬
<FromGitter> <Blacksmoke16> should run a `--warnings all`
<FromGitter> <dscottboggs_gitlab> I did not know that was a thing
<FromGitter> <Blacksmoke16> theres a new `@[Deprecated("message")]` annotation now
<FromGitter> <dscottboggs_gitlab> that's a very good idea, I'm excited to give the MT scheduler a try too...just a matter of finding the time amidst everything else.
<FromGitter> <dscottboggs_gitlab> I'm off to bed though ✌️
<FromGitter> <Blacksmoke16> see you
f1refly has quit [Ping timeout: 264 seconds]
alexherbo21 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 244 seconds]
f1refly has joined #crystal-lang
alexherbo21 has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <m-o-e> congrats to the new release! love how crystal continues to shape up
<FromGitter> <m-o-e> just one thing i don't love: the needless deviations from ruby syntax. (includes vs include, and now foo[1..] instead of foo[1..-1]) why do we keep doing that? :(
<FromGitter> <tenebrousedge> Crystal is not Ruby
<FromGitter> <m-o-e> and for that reason we make it extra hard for the people who go back and forth between them on a daily basis?
<FromGitter> <tenebrousedge> no, but for that reason the Crystal developers don't need to constrain themselves to only making a Ruby clone
<FromGitter> <m-o-e> i'm not talking about constraints. i'm just asking why we vary the syntax there, when the familiar ruby synax would work just as well.
<FromGitter> <tenebrousedge> 1) Ruby has endless ranges too https://blog.bigbinary.com/2018/07/04/ruby-2-6-adds-endless-range.html ⏎ 2) It sounds like you want to be more heavily involved in Crystal development
<FromGitter> <m-o-e> oh, i indeed didn't know that! (looks like it was added fairly recently?). ok, then my point is moot. :)
<FromGitter> <tenebrousedge> I would tend to assume that just about everything in Crystal is evaluated against Ruby's functionality, and that there is an explanation for any differences in the Issues list.
<FromGitter> <m-o-e> that's great! i was just coming from the blog post and didn't know that ruby had added the same syntax recently. mea culpa :)
<FromGitter> <tenebrousedge> yes, I learned about that from the Crystal Github issue #7170 just now, so it's news to me too.
<sagax> hi all!
<sagax> what great plugins from vim we have?
<sagax> in context crystal-lang
DmitryBochkarev has joined #crystal-lang
DTZUZO has quit [Ping timeout: 246 seconds]
<FromGitter> <tenebrousedge> I use SpaceVim, which has a Crystal plugin for syntax highlighting and some degree of linting
sz0 has joined #crystal-lang
<FromGitter> <bew> There is a vim plugin called vim-crystal (note: you don't necessarily need SpaceVim)
<FromGitter> <mavu> I use vim and vim-crystal, and it works well, altough it is occasionally possible to confuse it with c-bindings. Nor really a problem though
DTZUZO has joined #crystal-lang
ashirase has quit [Ping timeout: 255 seconds]
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
alexherbo2 has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
DmitryBochkarev has quit [Quit: Leaving]
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
<FromGitter> <drum445> Nice work with the release all!
japanoise has joined #crystal-lang
<FromGitter> <TheOnlyArtz> Hey, `mutex.synchronize` will lock and then unlock right away?
<FromGitter> <dscottboggs_gitlab> I use vim-crystal, and would recommend setting the `let g:crystal_auto_format = 1` option in your `.vimrc` -- it's not set by default and makes things much nicer.
<wuehlmaus> dscottboggs_gitlab: what exactly does it add to the default way?
<FromGitter> <dscottboggs_gitlab> it runs `crystal tool format` on the open file
<wuehlmaus> ah, thanks
<wuehlmaus> because indentation works in the default version, so i wasn't sure about the difference
<FromGitter> <dscottboggs_gitlab> yeah, it'll kinda do auto-indenting, but it doesn't format things as neatly as the format tool does.
<livcd> there is no crystal talk on rubykaigi right?
<livcd> nothing i can find ...
misaki_m has joined #crystal-lang
dunpeal has joined #crystal-lang
<dunpeal> How much industry use does Crystal see right now?
<FromGitter> <dscottboggs_gitlab> shit...crystal doesn't offer any way to do multiple inheritance...does it? I need to represent a class which implements two abstract classes...
<FromGitter> <dscottboggs_gitlab> @dunpeal, there are several companies which run crystal as a server-side platform, either with the Lucky or the Amber libraries. I think there's an AI company and a blockchain company who use Crystal.
<z64> @dscottboggs_gitlab you can include multiple modules that contain `abstract def`s
<dunpeal> Thanks!
dunpeal has left #crystal-lang [#crystal-lang]
lucasb has joined #crystal-lang
misaki_m has quit [Quit: Mutter: www.mutterirc.com]
Yxhuvud has quit [Ping timeout: 240 seconds]
_ht has joined #crystal-lang
f1refly has quit [Ping timeout: 258 seconds]
yxhuvud has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <kingsleyh> hey - any reason the 0.28.0 Crystal packages for Mac OS specify LLVM: 3.9.1
<FromGitter> <kingsleyh> I thought the previous release had LLVM: 6
<FromGitter> <kingsleyh> no brew package yet :(
<FromGitter> <j8r> @dscottboggs_gitlab use composition then :)
<FromGitter> <ananagame> I'm working on a fork of crystal and I would like to know can I use C bindings?
<FromGitter> <r00ster91> yes you can
<FromGitter> <ananagame> because I need a lot of decimals
<FromGitter> <r00ster91> some things in the stdlib are implemented with C functions
<FromGitter> <r00ster91> like `exit` or `sleep`
<FromGitter> <ananagame> ok thanks
<FromGitter> <kingsleyh> aha problems with brew: https://github.com/Homebrew/homebrew-core/pull/39026
<FromGitter> <j8r> having a patched libgc, with libgc.a brought don't help
<FromGitter> <j8r> mps it think it's fine to still use libgc from alpine, at least for now?
<mps> j8r: is it updated in repo
<mps> yes, it is, just checked
<mps> gc-dev-8.0.4-r0
<mps> btw, I'm working on changes to make crystal-static apk with builders
<FromGitter> <ananagame> can I put a type thats allows more decimals than float64 in a C binding
<FromGitter> <j8r> I wasn't really talking about this mps, more about the patched gc (https://github.com/crystal-lang/distribution-scripts/blob/master/linux/files/feature-thread-stackbottom.patch)
<FromGitter> <j8r> I'd say to not bother with this, it's only a preview for now
<mps> ah, I misunderstood you. will look at the url
<FromGitter> <j8r> that's a patch to bdwgc, to support `preview_mt`
<mps> I see. thanks
CommanderViral has quit [Quit: ZNC 1.7.1+deb1+bionic1 - https://znc.in]
<FromGitter> <j8r> IMHO this doesn't worth it to bother much on this - using gc-dev is fine
<mps> agree, it is fine for me as it now.
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Max SendQ exceeded]
DmitryBochkarev has joined #crystal-lang
<FromGitter> <bew> @ananagame what type are you using?
<FromGitter> <nsuchy> Occasionally when I write bad queries or method calls with Granite the compiler gives me a really weird error
<FromGitter> <nsuchy> Any ideas what’s happening here?
<FromGitter> <Blacksmoke16> :shrug: does it happen if its not in the context of amber watch?
<FromGitter> <Blacksmoke16> @nsuchy
<FromGitter> <Blacksmoke16> if you have some code that can reliably reproduce id file an issue on granite repo
Jenz has joined #crystal-lang
<Jenz> Topic on IRC still says Crystal 0.27.1
* Jenz O_o
alexherbo26 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 246 seconds]
_whitelogger has joined #crystal-lang
<wuehlmaus> nobody seems to be able to be op?
<Jenz> Well, topic was last set by RX14, I don't see why he can't do it again
<wuehlmaus> i already asked him and he never reacted :-(
<wuehlmaus> so i bet he is too busy with university stuff
CommanderViral has joined #crystal-lang
CommanderViral has quit [Quit: ZNC 1.7.1+deb1+bionic1 - https://znc.in]
lucasb has quit [Quit: Connection closed for inactivity]
DmitryBochkarev has quit [Ping timeout: 244 seconds]
Jenz has quit [Ping timeout: 246 seconds]
devil_tux has joined #crystal-lang
<devil_tux> hi crystal :> is something like this possible? I remember doing it in a similar way in the past: https://play.crystal-lang.org/#/r/6r9y
<FromGitter> <Blacksmoke16> whats the point?
<FromGitter> <tenebrousedge> don't you mean to call `new` there?
<devil_tux> Blacksmoke16: I want to identify specific key value strings
<FromGitter> <Blacksmoke16> sorry i dont follow?
<devil_tux> think of it as a prefix to a String, for example when reading code.. apparently there is no proper use case
<FromGitter> <Blacksmoke16> just make it `NOT.new("this")`
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <tenebrousedge> except that there is no `String.new(String)`
<devil_tux> tene: that means method with return String is possible option?
<devil_tux> would also help ditching `.new`
<FromGitter> <Blacksmoke16> u suppose you could just do like
<devil_tux> something like: def NOT(*) : String; end
<FromGitter> <tenebrousedge> a method could return a string, yes. You could define that method on the global object if you needed to
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6ra5
<FromGitter> <Blacksmoke16> still kinda pointless imo
<FromGitter> <Blacksmoke16> why not just add a comment like `# NOT THIS ONE`
<FromGitter> <tenebrousedge> method names can't be all-caps
<devil_tux> only const? what about aliases?
<devil_tux> Blacksmoke16: feels, reads, and works ugly tbh
<FromGitter> <Blacksmoke16> but creating some method to wrap a string isnt? :P
<FromGitter> <Blacksmoke16> just to differentiate that string
<devil_tux> ah, at the global and short use it isn't much of an overhead.. which can be said for comments too lol
<FromGitter> <tenebrousedge> what is the context here?
<devil_tux> tene: dummy snip https://play.crystal-lang.org/#/r/6ra8
alexherbo26 is now known as alexherbo2
<FromGitter> <tenebrousedge> using `each` when your loop needs to create a new value is usually suboptimal
ashirase has quit [Ping timeout: 244 seconds]
ashirase has joined #crystal-lang