ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.22.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<crystal-gh> [crystal] Val opened pull request #4508: [vagrant provisioning] make git call the last one (master...fix_vagrant_provisioning_script_order)
<crystal-gh> [crystal] Val opened pull request #4510: [vagrant box] update Ubuntu vivid to xenial (LTS) (master...update_vivid_vagrant_box_to_xenial)
_whitelogger has joined #crystal-lang
ctxz has quit [Quit: Page closed]
<FromGitter> <sdogruyol> @elorest great
<FromGitter> <sdogruyol> there's a lot of interest to Crystal, hopefully we'll make it easier for newcomers to get on board
<crystal-gh> [crystal] akzhan opened pull request #4511: [WIP] String.casefold and Char.casefold instance methods (master...string-and-char-casefold)
<FromGitter> <elorest> I’m doing everything I can.
<FromGitter> <sdogruyol> same :)
<FromGitter> <elorest> :)
<FromGitter> <sdogruyol> thanks for being awesome @elorest :tada:
<FromGitter> <bluetwin> where was the talk? (im new here but want to help)
<FromGitter> <elorest> Write now pretty much the whole crystal community is pretty cool. Like 2005 with ruby.
<FromGitter> <sdogruyol> Hey @bluetwin welcome :)
<FromGitter> <elorest> welcome!
<FromGitter> <sdogruyol> I did a talk at a Ruby conference in Ukraine
<FromGitter> <bluetwin> thanks!
<FromGitter> <bluetwin> @sdogruyol cool!
<FromGitter> <bluetwin> I’ve been a rubyist since 2004, Chicago originally, but in Seattle and looking to contribute where I can.
<FromGitter> <bluetwin> how big is the community? also is it pretty spread out or concentrated?
<FromGitter> <bluetwin> I was talking to some RoR people at Twilio’s SIGNAL conf and crystal came up a bunch
<FromGitter> <sdogruyol> I don't know an exact number but as you can see only in gitter we have 500+ and it's from all around the world
<FromGitter> <sdogruyol> for example i'm from Istanbul, Turkey
<FromGitter> <sdogruyol> it's great to hear Crystal being talked :P
<FromGitter> <bluetwin> There are a lot of people not sure about the migration to elixir and phoenix.
<FromGitter> <elorest> And I’m from `Utah` of all places lol
<FromGitter> <sdogruyol> Elixir is great but i feel right at home with Crystal from day 0
<FromGitter> <elorest> Yeah same here. I like elixir more than node but something seems off and it’s not the functional part.
<FromGitter> <elorest> I’m pretty happy in C.
<FromGitter> <sdogruyol> think of Ruby but for 21st century :P
<FromGitter> <sdogruyol> it's more like Ruby 4.0
<FromGitter> <bluetwin> same feeling here
<FromGitter> <sdogruyol> having a compiler really saves a lot
<FromGitter> <elorest> why is the `not_nil!` necessary here? ⏎ `if upload.filename.is_a?(String) && !upload.filename.not_nil!.empty?`
<FromGitter> <elorest> shouldn’t the fact that’s it’s a string be enough to know that it’s not nil.
<FromGitter> <sdogruyol> actually it's not
<FromGitter> <elorest> not what?
<FromGitter> <sdogruyol> it's String?
<FromGitter> <sdogruyol> let me check hold on
<FromGitter> <elorest> ```code paste, see link``` []
<FromGitter> <elorest> there’s the whole block...
<FromGitter> <elorest> for some reason filename is ending up as “” instead of nil...
<FromGitter> <elorest> but it’s still a union with nil.
<FromGitter> <sdogruyol> is this from amber?
<FromGitter> <elorest> yeah
<FromGitter> <sdogruyol> well, you're right
<FromGitter> <sdogruyol> it's because of multipart, a filename can just be nonexistent
<FromGitter> <elorest> Ok. But shouldn’t checking that it’s a string render nil checking afterwards pointless?
<FromGitter> <sdogruyol> seems like you don't have to do that not_nil!
<FromGitter> <elorest> I already have that up… I think a newer version of crystal must have changed it. Kemal works with that but if you try using it you need to check both that filename exists and isn’t empty in your route...
<FromGitter> <elorest> I can’t remove the checks in amber too but then I have to do them in the action.
<FromGitter> <sdogruyol> really?
<FromGitter> <elorest> Yeah. I’m on 0.22.0
<FromGitter> <sdogruyol> yeah i leave the empty check to user actually
<FromGitter> <sdogruyol> ```code paste, see link``` []
<FromGitter> <sdogruyol> yep
<FromGitter> <elorest> Yeah… but you need to also check empty string for some reason now.
<FromGitter> <sdogruyol> hmm this example just works as it is
<FromGitter> <elorest> hmmm that’s weird. I’m doing pretty much the exact same thing.
<FromGitter> <elorest> I’m trying it in Kemal again.
<FromGitter> <sdogruyol> @elorest use this ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <elorest> Yep I’m having the same issue in kemal
<FromGitter> <sdogruyol> really?
<FromGitter> <elorest> I’ll try that.
<FromGitter> <elorest> ```code paste, see link``` []
<FromGitter> <elorest> Yeah I had to add the empty check and not_nil!
<FromGitter> <sdogruyol> this `filename = file.filename`
<FromGitter> <elorest> in the File.join.
<FromGitter> <elorest> I’ll try that.
<FromGitter> <sdogruyol> saves the day
<FromGitter> <elorest> Yep. Why is that?
<FromGitter> <sdogruyol> union type :)
<FromGitter> <elorest> you probably want to add that to your docs.
<FromGitter> <sdogruyol> the compiler infers the type beforehand
<FromGitter> <sdogruyol> why?
<FromGitter> <sdogruyol> this is internal to kemal
<FromGitter> <elorest> but if one variable has a union of (Nil | String) and you save it to another variable it’s just a string?
<FromGitter> <sdogruyol> nope
<FromGitter> <sdogruyol> if you handle the both condition cases the runttime type is the returning one
<FromGitter> <sdogruyol> in this case it's just `String`
<FromGitter> <elorest> Because your docs don’t say to do `filename = file.filename`. So when if I follow the instructions on your site it doesn’t work.
<FromGitter> <sdogruyol> but compile time type is `String | Nil`
<FromGitter> <elorest> Interesting.
<FromGitter> <sdogruyol> you're actuall right
<FromGitter> <sdogruyol> thanks for the feedback
<FromGitter> <sdogruyol> i'll fix the docs asap
<FromGitter> <elorest> Yeah anytime.
<FromGitter> <elorest> Thanks.
<FromGitter> <sdogruyol> :metal:
<FromGitter> <sdogruyol> btw i really like where amber is going
<crystal-gh> [crystal] asterite pushed 3 new commits to master:
<crystal-gh> crystal/master 5af6fb7 Ary Borenszweig: Char::Reader: make sure previous_char returns Char
<crystal-gh> crystal/master 91f1035 Ary Borenszweig: Another way to fix #4311
<crystal-gh> crystal/master 7c51424 Ary Borenszweig: Revert "Fixed #4311: `{"a" : 1}` won't parse anymore as a named tuple"...
<FromGitter> <akzhan> I should note that master branch of Crystal is broken. ⏎ ⏎ spec/compiler/macro/ throw errors.
<FromGitter> <elorest> Thanks.
<FromGitter> <elorest> @sdogruyol I think that with the files if we check on parsing we can avoid creating that object if it’s empty. Should save a tiny bit of time and memory and make it easier for the end user.
rohitpaulk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#5af6fb7 (master - Char::Reader: make sure previous_char returns Char): The build was fixed.
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <ylluminate> why not crystal:
<FromGitter> <ylluminate> a crystal linux would sure be remarkable
rohitpaulk has joined #crystal-lang
<FromGitter> <faultyserver> there's already, but it's more PoC than anything else
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <bararchy> So, who want's to help me build a mail serve (postfix style) in Crystal ? -->
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <sdogruyol> @bararchy i'd really love to but have no exp :P
<FromGitter> <sdogruyol> i also want to have an smtp layer for connecting to smtp servers
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <bararchy> @sdogruyol I dont have expireance too XD it's just fun playing around, when I get into a "what does this means" I just go to the RFC page and see, implamenting protocols is just following instructions
<FromGitter> <sdogruyol> yeah but i find following (reading) RFCs hard and boring :D
<FromGitter> <bararchy> @sdogruyol If you will do the cool networking\DB\handeling I'll handle boring RFC and validation XD
<FromGitter> <sdogruyol> BTW how's your company's big Crystal project going on @bararchy
<FromGitter> <bararchy> Well, we will know after tomorow when we will finish talking with Manas ;) ⏎ But all in all it's gonna be awsome. I also hope we can release parts as OpenSource
<FromGitter> <sdogruyol> wow, exciting times ahead :)
<FromGitter> <bararchy> indeed !
<FromGitter> <bararchy> addoptaion has to start somewhere
<FromGitter> <sdogruyol> i really agree with that
<FromGitter> <sdogruyol> way to 1.0 and beyond needs more people pitching in :tada:
<FromGitter> <bararchy> It's true, we need to get Google or Facebook to release something like "We saw Crystal and decided to drop Go "
<FromGitter> <bararchy> XD
<FromGitter> <sdogruyol> trust me there're a lot of people wanting to do that
<FromGitter> <sdogruyol> just a RubyC conference i talked with at least 5 people who want to use Crystal instead of X (mostly Go)
<FromGitter> <bararchy> As a Ruby dev it's a no brainer , the interesting part is other devs from differrent langs, as in , C\C++ devs or java , etc..
rohitpaulk has joined #crystal-lang
<FromGitter> <Koroeskohr> hello people ! i'd like to get started with crystal and get involved in the community, where should I start ? i have a solid experience with ruby dev, is there any article/blog post indicating from where to start to catch up with the language subtleties ? thanks :)
A124 has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <bararchy> @Koroeskohr There are the Docs, the API and more at : ⏎
<FromGitter> <bararchy> And you can also try it online at:
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<crystal-gh> [crystal] akzhan opened pull request #4512: .downcase(Unicode::CaseOptions::Fold) using char ranges (master...string-and-char-casefold-using-ranges)
<crystal-gh> [crystal] akzhan closed pull request #4511: .downcase(Unicode::CaseOptions::Fold) without char ranges (master...string-and-char-casefold)
<FromGitter> <akzhan> By the way how to beatify this code? ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <sdogruyol> ``````
<FromGitter> <akzhan> no, i want to et yielded array by one line :)
<FromGitter> <sdogruyol> oh :)
<FromGitter> <sdogruyol> ```'ß'.downcase(Unicode::CaseOptions::Fold).map``` ⏎ ⏎ maybe? []
<FromGitter> <akzhan> downcase without block has difefrent behavior :(
<FromGitter> <sdogruyol> oh
<FromGitter> <sdogruyol> isnt that a bit surprising behaviour?
<FromGitter> <akzhan> So it should be reviewed by @asterite
<FromGitter> <sdogruyol> ofc
<FromGitter> <akzhan> Another trouble that doesn’t know about folding. ⏎ ⏎ I can update code but it will have big performance penalty.
<FromGitter> <sdogruyol> that's a bummer
<FromGitter> <akzhan> Now we may do ` a.downcase(Unicode::CaseOptions::Fold) <=> a.downcase(Unicode::CaseOptions::Fold)`
<FromGitter> <akzhan> or may implement String.locale_compare
<RX14> @akzhan you should add an option to compare which compares with folding
<RX14> but have it off by default
<RX14> so people can choose the performance penalty when they need it
<FromGitter> <sdogruyol> i'm not sure why but `Regex#match` started to return `(Nil:Class | Regex::MatchData:Class)` instead of just `Regex::MatchData:Class`
<FromGitter> <sdogruyol> does anyone know why?
<RX14> why would it return :Class
<RX14> that sounds wrong
<RX14> can you show code?
<FromGitter> <sdogruyol> btw this is on master, it works on 0.22.0
<RX14> eq not be
<RX14> be is for types
<RX14> iirc
<RX14> lket me check
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <sdogruyol> well, it's working before
<RX14> well the match code hasn't changed since february
<RX14> and the method is annotated
<RX14> yeah i was wrong about be
<RX14> it uses same?
<RX14> @sdogruyol it doesn't even compile for me on master
<RX14> @sdogruyol it's because matvhdata is now a struct, use eq
<RX14> you rarely want be instead of eq in specs
<RX14> matchdata*
<FromGitter> <akzhan> @RX14 just created #4513 issue to discuss.
<DeBot> ( doesn't take into account case folding)
<RX14> why not just add an option to compare instead of adding a new method?
rohitpaulk has joined #crystal-lang
<FromGitter> <akzhan> it’s good proposal but I need to know what’s chosen. Just to implement it only once.
<FromGitter> <akzhan> Will be followed by PR :)
A124 has joined #crystal-lang
bmcginty has quit [Ping timeout: 268 seconds]
bmcginty has joined #crystal-lang
balduin has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master:
<crystal-gh> crystal/master 0a375f5 RX14: Fix current-stage compiler stats output...
<FromGitter> <ylluminate> @faultyserver while that's really cool, the logic that he sets forth in his writeup is pretty irrefutable.
<travis-ci> crystal-lang/crystal#0a375f5 (master - Fix current-stage compiler stats output): The build passed.
<crystal-gh> [crystal] asterite pushed 5 new commits to master:
<crystal-gh> crystal/master 5e1df56 Will Leinweber: FloatPrinter: fix -NaN test, fix formatting
<crystal-gh> crystal/master d8c8417 Will Leinweber: FloatPrinter: make docs and interface more consistent
<crystal-gh> crystal/master 08dcf53 Will Leinweber: Add FloatPrinter based on Grisu3...
<travis-ci> crystal-lang/crystal#32f583f (master - FloatPrinter: add license to specs): The build passed.
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Client Quit]
balduin has quit [Quit: Leaving.]
snsei has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
<FromGitter> <bew> Is it possible to override `Hash#each` ? using `previous_def` gives me `no previous definition of 'each'`:
<RX14> @bew you want super not previous_def
<RX14> you're not monkeypatching you're overriding
A124 has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> oh yes thanks!
<RX14> also please compose hash not extend it
<RX14> well actually it might not be possible here
A124 has joined #crystal-lang
<RX14> but if it is possible
<RX14> it's probably better
<FromGitter> <bew> true, was just trying some things
<FromGitter> <bew> what's the 'true' reason for this?
<RX14> because stdlib classes have no API stability in their internals unless they're meant to be inherited
<RX14> also it makes using hash slightly shower for every place
<RX14> at least it might
<RX14> i'm pretty sure the compiler has difficuly proving that a Hash isn't a My::Hash in a lot of places
<FromGitter> <bew> hmm I see, thx
<RX14> and now you've got a multiple dispatch
<RX14> instead of just a normal dispatch to each
<RX14> plus the code is usually cleaner
<jeromegn> oh noes :(
<jeromegn> oh, it's back
<jeromegn> there was a json parsing exception
sagax has quit [Ping timeout: 268 seconds]
<FromGitter> <bararchy> There's nothing better then looking at and seeing so many projects spawning every hour :)
<FromGitter> <bararchy> @sdogruyol hmmm
<FromGitter> <bararchy>
<FromGitter> <bew> x)
<FromGitter> <bararchy> It's seems like it should check the type before no ? lol
<crystal-gh> [crystal] RX14 opened pull request #4515: Add XML#unlink (master...MrSorcus-master)
<crystal-gh> [crystal] asterite pushed 3 new commits to master:
<crystal-gh> crystal/master c4b27d4 Ary Borenszweig: Add Object#unsafe_as and use it in a few places
<crystal-gh> crystal/master 09a301e Ary Borenszweig: Char: fixed upcase docs
<crystal-gh> crystal/master 4d07680 Ary Borenszweig: Rename FloatPrinter to Float::Printer. Related to #4333
bmcginty has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
teratoma has quit [Quit: leaving]
Winty has joined #crystal-lang
<Winty> hey guys. i have a question about crystal. why i can't user pointerof(self) but*) works and returns me the pointer to the current instance?
<RX14> why can't you use pointerof(self)
<RX14> >>class Foo; def selfptr; pointerof(self); end; end;
<DeBot> RX14: Syntax error in eval:17: can't take pointerof(self) -
<RX14> huh
<RX14> that makes no sense
<Winty> yeah
<RX14> >>class Foo; def selfptr;*); end; end; f =; pp f.object_id, f.selfptr
<DeBot> RX14: f.object_id # => 23154656 - more at
<RX14> >>"0x1614fe0".to_i64(16)
<DeBot> RX14: 0x0: ??? at ?? -
<RX14> >>"1614fe0".to_i64(16)
<DeBot> RX14: # => 23154656 -
<travis-ci> crystal-lang/crystal#c4b27d4 (master - Add Object#unsafe_as and use it in a few places): The build passed.
<RX14> so yup
<RX14> you're entirely right
<RX14> i have no idea why pointerof(self) isn't allowed
dostoyev1ky has joined #crystal-lang
<Winty> yeah that won't help me because that local variable is cleaned when current scope ends
<RX14> well
<RX14> i'll tell you what
<RX14> >>class Foo; def selfptr; pointerof(foo = self); end; end;
<Winty> only create duplicate of self as member variable and get pointer to that
<Winty> but thats really ugly
<RX14> >>class Foo; def selfptr; foo = self; pointerof(foo); end; end;
<DeBot> RX14: # => Pointer(Foo)@0x7fff4a9ea5b0 -
<RX14> yeah thats ugly
<RX14> it's so... trivial to work around
<RX14> that I think the limitation should just be removed
<RX14> sure you can replace selfptr's value, but thats really not a big issue
<Winty> well it depends. i'm using it as a workaround for unability to pass clojures to C functions, which should get fixed and then i cant think of any more situations where you woudl want pointer to self
<RX14> well
<RX14> have you read how to pass closures to C functions?
<FromGitter> <bew> you can use `` for that
<RX14> you don't need to use pointerof(self)
<RX14> >which should get fixed
<RX14> it wont be
<RX14> is how you do it
<FromGitter> <bew> Winty ^
<Winty> oh nice that works
<Winty> thanks!
greenbigfrog has quit [*.net *.split]
aemadrid has quit [*.net *.split]
Majost has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
avdi has quit [*.net *.split]
kiliankoe has quit [*.net *.split]
aemadrid has joined #crystal-lang
kiliankoe has joined #crystal-lang
avdi has joined #crystal-lang
Majost has joined #crystal-lang
greenbigfrog has joined #crystal-lang
Lex[m] has quit [Ping timeout: 240 seconds]
vegai has quit [Ping timeout: 240 seconds]
kodo[m] has quit [Ping timeout: 240 seconds]
braidn[m] has quit [Ping timeout: 258 seconds]
sija[m] has quit [Ping timeout: 255 seconds]
thelonelyghost has quit [Ping timeout: 255 seconds]
TheGillies has quit [Ping timeout: 264 seconds]
MatrixTraveler[m has quit [Ping timeout: 258 seconds]
werthen[m] has quit [Ping timeout: 264 seconds]
krigare[m] has quit [Ping timeout: 255 seconds]
<FromGitter> <bew> why is there the limitation when trying to pass a closure to C function as callback? Is it because the GC won't be found in some cases?
MatrixTraveler[m has joined #crystal-lang
<FromGitter> <sdogruyol> yeah
<FromGitter> <bew> when the callback is used in another thread from the C world maybe?
<FromGitter> <bew> huh no that will create scheduler issues IMO, don't knwo about GC
Winty has quit [Quit: Page closed]
braidn[m] has joined #crystal-lang
kodo[m] has joined #crystal-lang
vegai has joined #crystal-lang
TheGillies has joined #crystal-lang
thelonelyghost has joined #crystal-lang
Lex[m] has joined #crystal-lang
krigare[m] has joined #crystal-lang
sija[m] has joined #crystal-lang
werthen[m] has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #4515: Add XML::Node#unlink (master...MrSorcus-master)
<travis-ci> crystal-lang/crystal#40033d5 (master - Add XML::Node#unlink): The build passed.
snsei has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite closed pull request #4134: Formatter: fix to separate defs with visibility modifiers (master...fix/crystal-format/modifier-def)
<RX14> @bew @sdogruyol it's nothing to do with the GC
<RX14> crystal procs consist of a function pointer *and* a pointer to a data struct which contains the closure data
<RX14> (local variables referenced etc.)
<FromGitter> <bew> oh
<RX14> if you're trying to pass that to a C function which only expects a function pointer
<RX14> it doesn't work
<FromGitter> <bew> so from a closure, you need to create a proc without closure stuff, and pass it to the C lib along with the closure data or sth?
<RX14> what you have to do is pass a proc with no closure, and then pass a pointer to the old proc as a data argument to that proc
<RX14> so it's slower
<RX14> for sure
<FromGitter> <bew> wut Oo do you have an example?
<RX14> thats literally the example in the docs
<FromGitter> <bew> just curiosity, no use case
<RX14> with
<RX14> it passes the box to the C library as the "data argument" to the proc
<RX14> which is what I said
<RX14> that box contains the original proc
<FromGitter> <bew> *Going back re-read*
<FromGitter> <bew> okaaay makes sense now! I mis-read that part from the begining, even when I thought I understood what was going on! (or maybe I just forgot, too...)
<travis-ci> crystal-lang/crystal#430bf0b (master - Correct spec case): The build was broken.
<crystal-gh> [crystal] asterite pushed 2 new commits to master:
<crystal-gh> crystal/master 755f73a Ary Borenszweig: Fixed #4338: incorrect parsing of `exp rescue exp if exp`
<crystal-gh> crystal/master f3bf008 Ary Borenszweig: Improve compile times of lexer/parser specs