RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.3 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
x0f has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
ruby_ has quit []
snsei has quit [Ping timeout: 264 seconds]
x0f has joined #crystal-lang
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
kulelu88 has quit [Ping timeout: 256 seconds]
Philpax has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
x0f has quit [Ping timeout: 256 seconds]
x0f has joined #crystal-lang
coderobe has quit [Quit: Ping timeout (120 seconds)]
snsei has joined #crystal-lang
snsei_ has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 265 seconds]
mgarciaisaia has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
aharlan has joined #crystal-lang
aharlan has quit [Quit: I'm out.]
mgarciaisaia has quit [Ping timeout: 244 seconds]
mgarciaisaia has joined #crystal-lang
pawnbox has joined #crystal-lang
scottj has quit [Quit: leaving]
pawnbox has quit [Ping timeout: 244 seconds]
eizua has joined #crystal-lang
eizua has quit [Client Quit]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
eizua has joined #crystal-lang
eizua has quit [Quit: Leaving]
eizua has joined #crystal-lang
eizua has quit [Client Quit]
eizua has joined #crystal-lang
eizua has quit [Client Quit]
sandelius has joined #crystal-lang
mark_66 has joined #crystal-lang
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sandelius has joined #crystal-lang
soveran has joined #crystal-lang
bjz has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
eizua has joined #crystal-lang
eizua has quit [Client Quit]
eizua has joined #crystal-lang
jeromegn has quit [Ping timeout: 272 seconds]
jeromegn has joined #crystal-lang
vonKingsley has joined #crystal-lang
x0f has quit [Ping timeout: 256 seconds]
x0f has joined #crystal-lang
vonKingsley has quit [Quit: Page closed]
snsei has quit [Remote host closed the connection]
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vPcVK
<crystal-gh> crystal/master e1b98a5 Julien Portalier: Fix: use __iconv on FreeBSD to skip invalid bytes (#3379)
<crystal-gh> [crystal] ysbaddaden closed pull request #3369: Openbsd support (master...openbsd-support) https://git.io/vPqqm
eizua has quit [Quit: Leaving]
<travis-ci> crystal-lang/crystal#b86bb3a (master - Merge pull request #3369 from ysbaddaden/openbsd-support): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/165448969
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
leafybasi is now known as leafybasil
pawnbox has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <sonic182> Hi good morning! I've a little question ⏎ ⏎ how can I set a variable = pointe of a class?
<FromGitter> <sonic182> pointer*
<RX14> >> foo = String.new; bar = pointerof(foo); p bar
<DeBot> RX14: Pointer(String)@0xbfbb2bac - more at https://carc.in/#/r/1be2
<RX14> like that @sonic182 ?
<FromGitter> <sonic182> For example I don't want to initialize a new instance of class, just make equal to other value on a certain future. The problem is that in a class constructor, a instance variable must be setted at beiginin, It's mandatory, but I want to set it after some proccesing
<RX14> so you want to create an instance of a class, but not run the constructor?
<RX14> that's possible really quite easilly but i wouldn't recommend it if you can help it
<FromGitter> <sonic182> how is possible? Yes that's what i want
<RX14> >> foo = String.allocate; foo.initialize; p foo
<DeBot> RX14: protected method 'initialize' called for Reference - https://carc.in/#/r/1be3
<RX14> well
<RX14> pretend String's initialize wasn't private
<RX14> but there you go
<FromGitter> <sonic182> Nice, thanks :)
<RX14> calling Class.new is simply an alias for that
<RX14> same as ruby iirc
<RX14> but as i said, it's unsafe and not really recommended
<RX14> all fields will be initialized as zero
<FromGitter> <sonic182> Yes but it's a variable that I'll sustitude
<FromGitter> <sonic182> not to use directly
<RX14> i'm still not quite sure what you mean, can you give a working code example?
<FromGitter> <sonic182> on a class X I've a instance variable @better_solution that will be setted on a future
<FromGitter> <sonic182> not at the construction stage. after some proccessing
<RX14> don't you just want to make it nillable then?
<RX14> and set it later
<RX14> and not be unsafe
<FromGitter> <sonic182> well, could be too, but I've to ve warn of using .as(Type) the time it's not nil
<FromGitter> <sonic182> to be*
<RX14> you should check
<RX14> just use value = @value.not_nil!
<RX14> or change the logic so that the value can be passed in the costructor
<RX14> I really wouldn't advise using allocate, I would advise structuring your logic somehow so that the variable is never nil
<RX14> or accept that it can be nil and handle it properly
<FromGitter> <sonic182> Ok, I've solved changed the logic, just I'm going to check if errors allocating, how bad could be
<FromGitter> <sonic182> I had other problem that maybe could be an issue
<FromGitter> <sonic182> 2**60 # => 0
<FromGitter> <sonic182> that's because it's a really big integer
<FromGitter> <sonic182> but it should say something, I discovered after some errors
<FromGitter> <sonic182> It must be a issue? or it works properly??
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
CompanionCube has quit [Ping timeout: 272 seconds]
pawnbox has quit [Remote host closed the connection]
CompanionCube has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
<BlaXpirit> sonic182, works properly pretty much
<BlaXpirit> asterite, how would you feel about moving implementations of Random-related methods (like Array#shuffle) into the file random.cr (same for specs)
AckZ has quit []
eizua has joined #crystal-lang
<FromGitter> <sonic182> https://github.com/sonic182/crystal_tests ⏎ I've cool stuffs there :)
<crystal-gh> [crystal] wmoxam closed pull request #3326: Adds support for OpenBSD (master...openbsd) https://git.io/viXYJ
Philpax has quit [Read error: Connection reset by peer]
mark_66 has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> @sonic182 like what? some benchmarks
pawnbox has joined #crystal-lang
<FromGitter> <sonic182> Well, the benchmarks not yet, just using Shell time program
<FromGitter> <sonic182> For benchmarks I've to implement the same code on other languages and compare times, maybe Java, go..
pawnbox has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> cool
<FromGitter> <sdogruyol> i'm especially curious about go
<Papierkorb> sonic182: You can also pass --release to the `run` command
Philpax has joined #crystal-lang
<FromGitter> <sonic182> Mmm ok nice to know
<FromGitter> <sonic182> It compiles (as release) and run right?
<BlaXpirit> sure
mark_66 has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
mark_66 has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
fryguy9 has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
soveran has quit [Remote host closed the connection]
fryguy9 has joined #crystal-lang
kulelu88 has joined #crystal-lang
optikfluffel has joined #crystal-lang
Philpax has quit [Ping timeout: 264 seconds]
coderobe has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPCBu
<crystal-gh> crystal/master 872f099 Ary Borenszweig: Compiler: Fixed ICE with closured self and block. Fixes #3388
emmanueloga has quit [Remote host closed the connection]
kiliankoe has quit [Remote host closed the connection]
aarongodin has quit [Write error: Connection reset by peer]
onionhammer1 has quit [Ping timeout: 276 seconds]
aarongodin has joined #crystal-lang
optikfluffel has quit [Ping timeout: 256 seconds]
soveran has joined #crystal-lang
emmanueloga has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
kiliankoe has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
mark_66 has quit [Remote host closed the connection]
fryguy9 has quit [Quit: Leaving.]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPCVR
<crystal-gh> crystal/master 3525bcd Ary Borenszweig: Make it compile with LLVM 3.6. Fixes #3389
A124 has quit [Quit: '']
A124 has joined #crystal-lang
onionhammer1 has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPC6r
<crystal-gh> crystal/master fece2f7 Ary Borenszweig: Implement the new path search algorithm
fryguy9 has joined #crystal-lang
soveran has quit [Remote host closed the connection]
miguel has joined #crystal-lang
miguel is now known as Guest25526
Guest25526 has quit [Client Quit]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fryguy9 has quit [Quit: Leaving.]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
mgarciaisaia has joined #crystal-lang
Renich has joined #crystal-lang
snsei has joined #crystal-lang
_whitelogger_ has joined #crystal-lang
leex has joined #crystal-lang
_whitelogger has quit [Remote host closed the connection]
fryguy9 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
mgarciaisaia has quit [Quit: Leaving.]
snsei has quit [Remote host closed the connection]
mgarciaisaia has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
A124 has quit [Quit: '']
fryguy9 has joined #crystal-lang
snsei has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
fryguy9 has joined #crystal-lang
fryguy9 has quit [Client Quit]
fryguy9 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
matp has quit [Quit: ZZzzzZz...]
matp has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
fryguy9 has quit [Quit: Leaving.]
fryguy9 has joined #crystal-lang
ruby_ has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
eizua has quit [Quit: Leaving]
<travis-ci> crystal-lang/crystal#fece2f7 (master - Implement the new path search algorithm): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/165576553
mgarciaisaia1 has joined #crystal-lang
fryguy9 has joined #crystal-lang
fryguy9 has quit [Client Quit]
_whitelogger has joined #crystal-lang
benoist has joined #crystal-lang
<benoist> hi all
<FromGitter> <sdogruyol> hey
_whitelogger_ has quit [Remote host closed the connection]
<benoist> I was working on my analytics engine again and noticed something that was inconsistent with my understanding of the Channels
<benoist> I have an http endpoint consuming events that are written to a file
<benoist> in another fiber I have a compactor running that reads the events from the file, compresses them and writes them to a new file
<benoist> but I some point the compaction process had to compress 1 million events during the compaction my http handler paused consuming the events
<benoist> the client that generated the event had to wait about 7 seconds for 1 event to be processed by the consuming service
<benoist> while normally it would only take micro seconds
<FromGitter> <sdogruyol> just a wild guess but probably the GC is kicking in
<FromGitter> <sdogruyol> at that specific time
<benoist> don't think so
<FromGitter> <sdogruyol> why not
<benoist> well as I'm flushing after compressing 2000 data points
<FromGitter> <johnjansen> @benoist did this happen once or start a pattern
<FromGitter> <johnjansen> of latency
<FromGitter> <sdogruyol> @benoist you are actually triggering GC?
<benoist> no I'm not, but I assumed that writing, flushing opening files would allow other fibers to do some work
<benoist> or even printing log statements as I'm also doing
<FromGitter> <johnjansen> what is that code intended to show? :-)
<benoist> it shows it handles the two fibers after eachother
<benoist> where as I would have expected it to be -.-.-.
<FromGitter> <sdogruyol> i'm just curious why are you using two channels for the exact same thing
<benoist> instead of ------......
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<benoist> I'm using 1 channel to signal that both fibers have finished
<FromGitter> <johnjansen> fibers are cooperative not preemptive
<benoist> ok I can understand -.-.-.-. wouldn't be the most efficient way of doing it
<FromGitter> <johnjansen> since the first spawn is a tight loop it probably wont yield any time to the second
<benoist> but I see the exact same thing when flushing a file some 1000s of times
<FromGitter> <johnjansen> if you had some non blocking action within each loop the behaviour might be different
<benoist> my understand was that doing IO operations it would be blocking
<FromGitter> <johnjansen> https://carc.in/#/r/1bfo
pawnbox has quit [Remote host closed the connection]
<benoist> yeah sleep will do it, but thats too big a price to pay
pawnbox has joined #crystal-lang
<FromGitter> <johnjansen> that was just a demo of non-blocking
<FromGitter> <johnjansen> IO is from memory non blocking
<benoist> yeah ok, but isnt writing to a file blocking?
<FromGitter> <johnjansen> @sdogruyol do you recall the blocking nature of IO
<FromGitter> <raydf> https://carc.in/#/r/1bfp
<FromGitter> <raydf> Whit sleeping works
<FromGitter> <raydf> with*
<benoist> yes thats correct
ponga has quit [Quit: Connection closed for inactivity]
<FromGitter> <johnjansen> haha @raydf :-) he’s trying to understand the blockingness of IO
<benoist> exactly :-)
<benoist> aren't we all :-)
<FromGitter> <johnjansen> im doing 10 HTTP GET’s in parallel with fibers, that might be a different situation though
<FromGitter> <raydf> we all :)
<FromGitter> <sdogruyol> @johnjansen that depends on the Event Loop
<benoist> yes HTTP calls should also allow other fibers to take over, or at least that was my understanding :-)
<FromGitter> <sdogruyol> an event loop always makes me feel kinda lost
<FromGitter> <johnjansen> i seem to recall @asterite saying that IO wasnt blocking, although my memory is sketchy
<FromGitter> <sdogruyol> if you are not yielding explicitly i dont see a reason for them to yield
<FromGitter> <sdogruyol> unless by chance
<FromGitter> <sdogruyol> i'm curious how those stuff is gonna be in a multi thread / core Crystal though
<FromGitter> <johnjansen> agreed
<benoist> ok so now it's just printing
<FromGitter> <sdogruyol> not sure but it's probably gonna be 1 event loop per 1 thread
<benoist> but I see the exact same thing with writing to a file
<benoist> and flushing it
<benoist> if it's non-blocking IO I would expect it not to block other fibers
<benoist> but in this case it's doing that
<FromGitter> <raydf> just curious, @benoist with the sleep between each flush works?
<benoist> yes it does
<benoist> but I can just explicitly yield the fiber as well
<FromGitter> <raydf> nice, with multiples threads it should be easier to write that kind of services
<FromGitter> <johnjansen> "A running fiber must explicitly "yield" to allow another fiber to run, which makes their implementation much easier than kernel or user threads."
<benoist> yep exactly
<benoist> I was just under the assumption doing file IO that would normally result in blocking the run loop, it would automatically yield
<benoist> read: the file write implementation explicitly yields
fryguy9 has joined #crystal-lang
<FromGitter> <sdogruyol> now this really makes sense
<FromGitter> <johnjansen> totally
<FromGitter> <sdogruyol> not just some random magic event loop there
<FromGitter> <sdogruyol> cool
<benoist> hehe I just looked at the yield function and its just a sleep(0)
fryguy9 has quit [Client Quit]
<FromGitter> <johnjansen> yeah so unless the code (or called code) in the fiber yields, it will block
<benoist> yep I knew I could do this
<benoist> but it was all about how IO should or shouldn't have done this for me
<benoist> that is still the question I have
<FromGitter> <johnjansen> well the control is in your hands ;-)
<FromGitter> <johnjansen> seems to me like magic background yields would be harder to handle
<benoist> you can see in the file descriptor io wait_writable function that it does reschedule
<benoist> unbuffered_write calls the wait_writeable
<FromGitter> <johnjansen> yeah, but what calls unbuffered_write
<benoist> the buffered io
<FromGitter> <johnjansen> NOTE: github search doesnt always work
<FromGitter> <johnjansen> :-)
<FromGitter> <johnjansen> you should direct your question to @asterite i think ;-)
<FromGitter> <raydf> that's why i love crystal, sometimes is faster reading the source code than api docs :).
<benoist> ;-)
soveran has quit [Remote host closed the connection]
<FromGitter> <johnjansen> watch out for the rabbit holes
<FromGitter> <raydf> Well the next version of crystal is looking promising with the multi threading code that waj and asterite are working.
Renich_ has joined #crystal-lang
Renich has quit [Ping timeout: 265 seconds]
Renich_ has quit [Ping timeout: 244 seconds]
Renich has joined #crystal-lang
<FromGitter> <sdogruyol> I wonder if the performance is gonna get a big boost or stay the same
<FromGitter> <sdogruyol> Mutex locks are gonna be there :D
Renich_ has joined #crystal-lang
Renich has quit [Ping timeout: 244 seconds]
willl has joined #crystal-lang
<FromGitter> <johnjansen> that will all depend @sdogruyol
<FromGitter> <sdogruyol> yep
<benoist> right so I think I will be continuing the conversation here, I case you guys are interested in finding out the answer
Renich_ has quit [Ping timeout: 256 seconds]
benoist has quit [Remote host closed the connection]
benoist has joined #crystal-lang
benoist has quit [Read error: Connection reset by peer]
benoist has joined #crystal-lang
benoist has quit [Remote host closed the connection]
benoist has joined #crystal-lang
jamie-discord has joined #crystal-lang
jamie-discord is now known as jamie-discord3
jamie_ca has quit [Remote host closed the connection]
benoist has quit [Ping timeout: 264 seconds]
<Cyrus> Hmm...I'm having a hell of a time trying to get something to work in Crystal. How would I go about being able to spawn an instance of /usr/bin/less from within Crystal and have that run until it is quit and then return back to my Crystal program?
soveran has joined #crystal-lang
<BlaXpirit> Cyrus, yeah strange, it just doesn't work :o
<BlaXpirit> Cyrus, i guess what happens is it detects that this is not a TTY and puts to stdout and stdout is ignored
<BlaXpirit> Cyrus, `Process.run("/usr/bin/less", ["test.cr"], output: STDOUT)`
pawnbox has quit [Remote host closed the connection]
<Cyrus> Let me try that.
<Cyrus> Well hrm.
<Cyrus> Ah nice, that did the trick.
<Cyrus> Thank you.
ruby_ has quit []
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
Philpax has quit [Ping timeout: 264 seconds]
snsei has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
snsei has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
<FromGitter> <raydf> is there any way to tell multi line text to remove extra spaces, tabs and carriage return?
<BlaXpirit> raydf, what's extra spaces
<FromGitter> <raydf> ex: ⏎ ``` ⏎ %[ ⏎ Test ⏎ Test TEST ... [https://gitter.im/crystal-lang/crystal?at=57f6c33784f1db06148b8047]
<FromGitter> <raydf> https://carc.in/#/r/1bhb
<FromGitter> <raydf> I'm following this issue: https://github.com/crystal-lang/crystal/issues/3383
<BlaXpirit> raydf, heh https://carc.in/#/r/1bhe
<FromGitter> <raydf> i'm using String builder for complex sql creation but would be better to have another type of multiline text.
<FromGitter> <raydf> ok, looks cleaner and easier to understand, thanks.
<BlaXpirit> raydf, also note
<BlaXpirit> > Leading whitespace is removed from the heredoc contents according to the number of whitespace that this last IDENT has
<FromGitter> <raydf> Where's the docs for heredoc?
<FromGitter> <raydf> :)
<BlaXpirit> ffs gitbook kills the anchor links
<FromGitter> <raydf> Thanks, nice, i'll need to reread all the docs to make sure i don't miss this kind of great features.
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
bjz_ has joined #crystal-lang
ruby_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
ruby_ has quit [Client Quit]
bjz_ has quit [Ping timeout: 256 seconds]
soveran has quit [Ping timeout: 256 seconds]
benoist has joined #crystal-lang
benoist has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
dhk has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
x0f has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
dhk_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
dhk has quit [Ping timeout: 244 seconds]