ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.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
_whitelogger has joined #crystal-lang
<FromGitter> <firejox> actually, it is fixed by #8284. The exception is raised from sender part.
<DeBot> https://github.com/crystal-lang/crystal/pull/8284 (Fix : Channel can send successfully but raise)
DTZUZO has quit [Ping timeout: 245 seconds]
sz0 has joined #crystal-lang
<FromGitter> <alxgsv> @firejox very useful fix, thank you! I thought I'm losing my mind )
DTZUZO has joined #crystal-lang
<FromGitter> <cserb> Is there something like a `abstract def self.foo` ... making it mandatory to define the class method `def self.foo() ... end`?
DTZUZO has quit [Ping timeout: 268 seconds]
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 245 seconds]
<FromGitter> <igor-alexandrov> Hi guys! Shrine 0.3.0 with plugin system and tons of different changes has been released today: https://github.com/jetrockets/shrine.cr/releases. I am waiting for your feedback. Thank you!
<FromGitter> <Blacksmoke16> @cserb not atm tno
duane has joined #crystal-lang
<FromGitter> <j8r> @igor-alexandrov you can use an enum here https://github.com/jetrockets/shrine.cr/blob/master/src/shrine/plugins/determine_mime_type.cr#L58 😉
<FromGitter> <j8r> I don't if ameba can catch this things
<FromGitter> <j8r> *don't know
<FromGitter> <j8r> Generally better avoiding symbols to have type safety
<FromGitter> <cserb> @Blacksmoke16 but it would make sense, right? Or am I trying to do something that would be bad style?
<FromGitter> <igor-alexandrov> @j8r Thanks. Will do.
<FromGitter> <Blacksmoke16> i think it would be nice, as are some cases where it would be useful
<FromGitter> <Blacksmoke16> is there an issue for it already? maybe do some searching on github
<FromGitter> <cserb> I can't find an issue for it...
<FromGitter> <cserb> ok I looked for open issues only 👍
<FromGitter> <tenebrousedge> I think Asterite is right
DTZUZO has joined #crystal-lang
<FromGitter> <firejox> https://play.crystal-lang.org/#/r/85cw ⏎ It could outperform existing code on rotation :) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dea6b81f65fec1c8ed239b4]
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <yxhuvud> @firejox How does a Deque compare?
HumanGeek has quit [Ping timeout: 240 seconds]
<FromGitter> <tenebrousedge> and why is this necessary?
<FromGitter> <firejox> @yxhuvud It focus on array compare. Deque itself takes a lot advantage on rotate
<FromGitter> <Blacksmoke16> @tenebrousedge why is abstract class methods necessary?
HumanG33k has joined #crystal-lang
<FromGitter> <tenebrousedge> no, the rotate thing
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <tenebrousedge> what I've learned about Crystal benchmarks is that I don't understand Crystal's internals enough to write good benchmarks, and that bad benchmarks can very easily create the appearance of small performance differences
<FromGitter> <igor-alexandrov> @j8r done, released 0.3.1. Thanks.
<FromGitter> <firejox> It is true. Benchmark is hard
<FromGitter> <tenebrousedge> so my question would be, is this a good benchmark, and if so, is a 20% performance gain worth the complexity of this code?
<FromGitter> <firejox> It is not good because I have not analyzed the density of the worst case yet .
<FromGitter> <firejox> The performance will depends on the depth of GCD.
<FromGitter> <j8r> @igor-alexandrov 🚀
<FromGitter> <firejox> If the rotate distance can divide the size, it will run efficiently.
<FromGitter> <j8r> @igor-alexandrov Side note, you can use `.mime?` in place of `Tools::Mime`- that's the same
<FromGitter> <j8r> good job
<FromGitter> <j8r> How your library compares to https://github.com/schovi/baked_file_system ?
<FromGitter> <firejox> If both size and rotate are fibonacci number, it will do more work.
<FromGitter> <firejox> So I need to analyze them.....
<FromGitter> <igor-alexandrov> @j8r question about https://github.com/schovi/baked_file_system was for me? I know, that I can use `.mime?`, but still `Tools::Mime` seems more readable to me...
<FromGitter> <j8r> as you wish
<FromGitter> <j8r> Yes for the question
<FromGitter> <igor-alexandrov> backed_file_system is a virtual file system, Shrine is a tool to manage uploads.
<FromGitter> <j8r> Perhaps the could add more info about this, I am a noob on this
<FromGitter> <j8r> I can upload an image to a server?
<FromGitter> <j8r> for instance
<FromGitter> <DRVTiny> @Blacksmoke16 This is very optimistic approach: any of the spawned fibers can "forgot" to send result to channel, so fiber waiting workers.times will freeze forever. channel.receive(timeout: 150) will be better, but AFAIK event loop in crystal does not support setting timeout per I/O operation. I can be mistaken.
<FromGitter> <firejox> more readable version https://play.crystal-lang.org/#/r/85e4
<FromGitter> <Blacksmoke16> @DRVTiny hm?
<FromGitter> <Blacksmoke16> in relation to what?
<FromGitter> <DRVTiny> @Blacksmoke16 sorry, don't understand your question. I mean that event loop can be redesigned to support fiber-unlocking on firing any-of-several-events, any-of-several-events, (event1 OR event2) AND event3, etc. In that case is will possible for fiber to wait for (timeout event OR channel i/o event). I don't know why there are no event loops that implements desribed logic with subscription for several events,
<FromGitter> ... not only one, but i in my opinion Crystal is a modern language where such "innovative" features may be implemented.
ht_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> @DRVTiny do you have the right person? I'm not sure what started this discussion
<FromGitter> <Blacksmoke16> ☝️ December 4, 2019 11:37 AM (https://gitter.im/crystal-lang/crystal?at=5de7e0c75ac7f22fb55dca0c) or is that what you are referring to?
<FromGitter> <CodingItWrong> I apologize if this is asked before/often. Has anyone played with interoperability between Crystal and Swift or Objective-C for building iOS apps?
<FromGitter> <jwoertink> I wonder if WASM should become a first class citizen within crystal
<FromGitter> <jwoertink> like how it is for Rust
<FromGitter> <jwoertink> Has anyone done anything in this space yet?
<FromGitter> <tenebrousedge> are we sure that's possible?
<FromGitter> <tenebrousedge> I thought I had read that WASM doesn't play nice with GC
<FromGitter> <bew> Hello (; did the talk from asterite at the chicago meetup been uploaded somewhere already?
duane has quit [Ping timeout: 250 seconds]
<hightower2> Hey folks any advice how I'd properly detect ctrl/shift/meta being pressed together with keys, while reading raw from STDIN?
duane has joined #crystal-lang
duane has quit [Remote host closed the connection]
<FromGitter> <mavu> @hightower2 I don't think you do detect that at all.
<FromGitter> <mavu> Its a different layer.
<FromGitter> <mavu> the keypresses go to the terminal program which displays the operating system shell.
<FromGitter> <mavu> which in turn runs your program.
<hightower2> mmm... I do agree that something may be missing, but I'd say the app can detect this, I just don't know how.
<FromGitter> <mavu> If you want to capture keypresses directly, you need to write a program that displays its own window and gets the keyevents from the window manager
<FromGitter> <mavu> you are never going to get keypress events through STDIN.
<FromGitter> <mavu> you get characters through STDIN.
<FromGitter> <mavu> including for example backspace which is the "character" CTRL-H
<FromGitter> <mavu> this key combination is received by your terminal window. and translated to a byte that corresponds (in an ancient protocol) to Backspace.
<hightower2> Yes, the approach I was trying so far is that the modifiers do affect the characters that I receive.
<hightower2> By looking at the codepoint of those chars (or well, at string.char_at(i).ord) I can see what the codepoint value is. And it is different for e.g. 'c' versus 'ctrl+c'
<FromGitter> <mavu> yes, that will work, but be aware that those characters have meaning.
<hightower2> However that has its own problems, it's not direct access to modifiers/state
<hightower2> yeah
<FromGitter> <mavu> not going to happen through STDIN.
<FromGitter> <mavu> That said, things like ncurses exist, and may be able to do some magic. but I seriously doubt it will give you modifier presses
<hightower2> yeah I wanted to avoid getting modifiers indirectly from chars received, but seems like it'll have to do
duane has joined #crystal-lang
<FromGitter> <kinxer> Anyone have any insight into why this (https://play.crystal-lang.org/#/r/85g7) works while this (https://play.crystal-lang.org/#/r/85g6) fails?
<FromGitter> <kinxer> From #8561. It seems really weird.
<DeBot> https://github.com/crystal-lang/crystal/issues/8561 (Inheritance breaks protected visibility)
<FromGitter> <Blacksmoke16> i think im more surprised the first one works
<FromGitter> <kinxer> Really? I thought that a protected method in a class could be accessed from other classes in the same module.
<FromGitter> <Blacksmoke16> afaik its same namespace
<FromGitter> <Blacksmoke16> i.e. `Foo` or its children
<FromGitter> <Blacksmoke16> first one shouldnt work, 2nd should :p
<FromGitter> <Blacksmoke16> wonder if someone added a `!` by mistake :trollface:
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5deab15ec3d6795b9f35de20]
<FromGitter> <kinxer> Ah... So the difference from `private` is heritability?
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5deab1818e906a1c8d802f64]
<FromGitter> <Blacksmoke16> apparently the first example is valid
<FromGitter> <Blacksmoke16> im not sure i get why tho
<FromGitter> <Blacksmoke16> if the method is declared as protected within `Foo` why does the `Namespace` module matter
<FromGitter> <Blacksmoke16> that allows it to be called in `Bar`
ht_ has quit [Remote host closed the connection]
<FromGitter> <igor-alexandrov> @j8r yes, you can upload, extract metadata from file, make additional processing (not yet implemented).
kotrcka has joined #crystal-lang