RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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> <Dillybob1992> Hey guys, i have a question about this loop and if i'm doing it correctly. socket.read_line will return a raise if end of file, and i catch that. but does that mean if the user is not sending any messages it will error out? or does that mean if the user disconnects? for my client.cr, i am basically doing loop do sleep(0.2) client << "muffin\n" and in between the messages, the user doesn't get connects.
<FromGitter> ... but he's not technically not sending anything
<FromGitter> <Dillybob1992> Err, that's confusing to explain sorry. Basically, for example, if I set `sleep(1)` on my client. In between those seconds, there is no data being sent, so why isn't the error being raised? But it's being raised when I disconnect
DTZUZO has quit [Ping timeout: 256 seconds]
<FromGitter> <l3kn> Is that combination of `loop` and `rescue` valid?
DTZUZO has joined #crystal-lang
<FromGitter> <l3kn> I think while the client sleeps, `read_line` just blocks, the exception is only raised if reading is not possible for some reason (e.g. the client disconnected)
<FromGitter> <l3kn> Something like `while incoming_message = socket.gets` might be easier to reason about
<FromGitter> <Dillybob1992> ohh ok, so the description here `Same as #gets, but raises EOFError if called at the end of this IO.`the "this IO" is referring to the TCP connection?
<FromGitter> <l3kn> pretty much
<FromGitter> <Dillybob1992> i see, got it now yeah, makes sense! ty
<FromGitter> <Dillybob1992> omg crystal has built in json support this is soo cool :)
snsei has joined #crystal-lang
vivus has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <jwaldrip> Does the db driver support inserts with returning. Last-id doesn’t really work because I use uuid and I have to refetch....
<FromGitter> <drujensen> yes, the pg driver does
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
OceannBoy has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <jtarchie> Does the `crystal spec` support running tests/specs in parallel?
<FromGitter> <bew> No
<FromGitter> <bew> It's sequential
<FromGitter> <bew> Tests are just function calls, and we currently don't suppirt parallelism
OceannBoy has quit [Ping timeout: 240 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <jtarchie> Doesn't support parallelism because of the single threaded evented nature of current cyrstal implementation or because spec just haven't implemented it yet?
<FromGitter> <bew> The former
<FromGitter> <bew> Parallelism is in the work though
<FromGitter> <jtarchie> Thanks for clarifying.
<FromGitter> <potz> Is ther
<FromGitter> <potz> Is there a way to inspect the macro expansion?
snsei has quit [Remote host closed the connection]
<FromGitter> <asterite> {{ debug }} inside a macro
snsei has joined #crystal-lang
<FromGitter> <bew> `{% debug %}` is better no?
<FromGitter> <potz> And it goes to adroit or...?
<FromGitter> <asterite> bew: ah, yes
<FromGitter> <potz> God this iPhone
<FromGitter> <asterite> a droit et a gauche
<FromGitter> <bew> Huh?
<FromGitter> <asterite> I saw "adroit" so I remembered that phrase, I don't know :-P
<FromGitter> <potz> LOL I'm sorry. It's just impossible to use gitter on mobile browser.
<FromGitter> <potz> 1) adroit was actually STDOUT lol
<FromGitter> <potz> had to come back to the computer to be able to type
snsei has quit [Ping timeout: 276 seconds]
<FromGitter> <potz> so if I use {{debug}} or {% debug %} inside a macro, will it write the macro expansion to STDOUT or... ?
<FromGitter> <asterite> it will write it to stdout, but at compile time
<FromGitter> <potz> cool, makes sense
<FromGitter> <potz> I guess that means we can't really see the expansion on the crystal playground
<FromGitter> <potz> Thanks man. This language is extremelly cool.
aroaminggeek has joined #crystal-lang
<FromGitter> <asterite> np. there's an issue about that: https://github.com/crystal-lang/crystal/issues/2981
wontruefree has joined #crystal-lang
vivus has quit [Quit: Leaving]
wontruef_ has joined #crystal-lang
wontruefree has quit [Read error: Connection reset by peer]
bmcginty has quit [Quit: leaving]
bmcginty has joined #crystal-lang
wontruef_ has quit [Quit: The Internet needs a break and I need a cookie]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
jxv has joined #crystal-lang
DTZUZO has quit [Quit: WeeChat 2.0]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
aroaminggeek has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
mark___ has joined #crystal-lang
mark___ has quit [Client Quit]
jxv has quit [Quit: zzz…]
rohitpaulk has joined #crystal-lang
OceannBoy has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
snsei has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
mark_66 has joined #crystal-lang
snsei has joined #crystal-lang
OceannBoy has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
alex`` has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
flaviodesousa has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
cbass has joined #crystal-lang
alex`` has quit [Ping timeout: 255 seconds]
alex`` has joined #crystal-lang
pabs has quit [Ping timeout: 248 seconds]
<FromGitter> <Dillybob1992> hey guys, im using `"crystal_cmd": "\"C:\\Users\\Nick\\Desktop\\bash.exe\" & crystal"` as my sublime text setting for the crystal package. however, am getting `PermissionError: [WinError 5] Access is denied` on CTRL+S (auto formatting). im on W10, using the unix subsystem
jnyw has quit [Quit: WeeChat 2.0.1]
<FromGitter> <Dillybob1992> i post some more info about it here (https://github.com/crystal-lang-tools/sublime-crystal/issues/34)
snsei has joined #crystal-lang
alex`` has quit [Ping timeout: 252 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
fnux has left #crystal-lang ["WeeChat 1.9.1"]
alex`` has joined #crystal-lang
snsei has quit [Ping timeout: 256 seconds]
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
hightower has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
Rinkana has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
vivus has joined #crystal-lang
vivus has left #crystal-lang [#crystal-lang]
cbass has quit [Ping timeout: 256 seconds]
rohitpaulk has quit [Ping timeout: 246 seconds]
return0e_ has joined #crystal-lang
pabs has joined #crystal-lang
return0e has quit [Ping timeout: 268 seconds]
<FromGitter> <straight-shoota> RX14 #3063 is still open
<DeBot> https://github.com/crystal-lang/crystal/issues/3063 (homebrew recipe lacking pcre dependency)
<RX14> oops
<RX14> thanks
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vNGaW
<crystal-gh> crystal/master 77de91f Lachlan Dowding: Fix Iterator spec typo: integreation -> integration
<Papierkorb> Can Crystal tell me which method it is for the "instance variable @foo wasn't initialized in all of the initialize methods" error?
<travis-ci> crystal-lang/crystal#77de91f (master - Fix Iterator spec typo: integreation -> integration): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/328127390
cremes has quit [Quit: cremes]
snsei_ has joined #crystal-lang
Rinkana has quit [Quit: Page closed]
DTZUZO has joined #crystal-lang
<FromGitter> <asterite> what do you mean? you want to know where that is implemented?
<FromGitter> <asterite> Oh... you mean in which `initialize`
<FromGitter> <asterite> I think in some cases it tells you... not sure if in all cases
<jokke> hm there is no dbus lib for crystal which supports events :/
<Papierkorb> asterite, at least in this case it didn't.
<FromGitter> <asterite> maybe it can be improved, though you should reduce it
<Papierkorb> Looked like a bug. It's an abstract class using @ivars initialized by all implementing classes. Adding a stupid #initialize to the abstract base class and super-ing into it "fixed" it
jxv has joined #crystal-lang
<RX14> i think the error messages have been neglected a bit recently
<RX14> ive noticed them often being wrong
<RX14> we need a test suite of them
<RX14> and to actually start catalogeing bad ones
<FromGitter> <asterite> Papierkorb: abstract classes must initialize the instance var, the compiler won't rely on subclasses here
<FromGitter> <asterite> Better to provide a constructor and expect subclasses to call super
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
snsei has quit [Ping timeout: 255 seconds]
aemadrid has quit [*.net *.split]
manveru has quit [*.net *.split]
aarongodin has quit [*.net *.split]
oz has quit [*.net *.split]
oz has joined #crystal-lang
aarongodin has joined #crystal-lang
aemadrid has joined #crystal-lang
manveru has joined #crystal-lang
snsei has joined #crystal-lang
jxv has quit [Quit: zzz…]
alex`` has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
cremes has joined #crystal-lang
<jokke> short question about unions
<jokke> is it absolutely necessary to include all union members in the crystal bindings? Especially if there's a padding member in the c union which should determine the size of the union
crystalist32 has joined #crystal-lang
<RX14> hmm
<RX14> I think String#rindex and Indexable#rindex's behaviour are inconsistent
<RX14> having so many methods is hard to keep track of...
claudiuinberlin has joined #crystal-lang
<crystalist32> when i have an array of tuples of String, Int32: how can I sort all these Tuples in the right order just by the Int32? not the String. Right now with .sort it sorts it with the String and the Int32. But he should just do it with the Int32
<RX14> edge cases are hard
<RX14> in my opinion , since the documentation states "If *offset* is present, it defines the position to _end_ the search", if offset is greater than size, it should be set equal to size
<RX14> oh, i mean size - 1 if offset >= size
Ven`` has joined #crystal-lang
<RX14> @crystalist32, arr.sort_by { |tuple| tuple[0] }
<RX14> meanwhile in rubyland: https://carc.in/#/r/3dmo
<RX14> string rindexes with an out of range index raises
<RX14> and array ones don't?
<RX14> I agree with the array behaviour of ruby here
<RX14> and obviously think that string should have the same behaviour as enumberable
<FromGitter> <asterite> RX14 me too. Right now it seems to be inconsistent in both Ruby and Crystal
<RX14> yeah
<RX14> at least in ruby it's not dependant on wheter the sting is ascii or not lol
<RX14> since strin.rindex delegates to slice.rindex for ascii optimization
<RX14> and well, you now have both behaviours randomly
<RX14> "randomly"
<RX14> but you get the idea
<FromGitter> <asterite> Oh, right, I didn't think of that
<RX14> lol
<RX14> I tried to illustrate it in that carc.in
<RX14> @asterite makes you wonder how many other things like this have been missed
<RX14> hmm, perhaps we should just take the "obvious" route and raise if we calculate offset to be out of bounds regardless
<RX14> if applications want the other behaviour they can normalize the offset by hand
<RX14> yeah I can't decide
<RX14> well being more restrictive is good I think
<RX14> its not too hard to implement the normalization externally
<RX14> applying some simple rules like: foo.rindex(x) must equal foo.size - foo.reverse.index(x) - 1 forall x
<RX14> would be great
<RX14> and being able to prove them
<FromGitter> <asterite> I think the method should raise if it falls out of bounds
<FromGitter> <asterite> We are doing that in all other cases, I think
<FromGitter> <asterite> (and if not, these are just bugs)
<RX14> nope
<RX14> index always returns nil
<RX14> all the current bounds checks just return nil
<RX14> instead of raise
<RX14> except for *one* on string in the unoptimized case
<FromGitter> <asterite> Hm, interesting. Maybe they should raise
<RX14> I think they should
<FromGitter> <asterite> My guess is that in Ruby the behaviour is not clear because when they saw that, there was already lots of code out there so they left it like that to avoid breaking code
<FromGitter> <asterite> but we can still break code
<RX14> I kind of miss haskell though, where you could write an invariant like I did above and prove it with pen and paper practically
Ven`` has quit [Ping timeout: 268 seconds]
<RX14> @asterite yeah and then we have to look at all the other searching methods on anything which behaves like a collection and check they raise out of bounds too...
<RX14> I started to define a String#rindex(offset, &block) method
<RX14> found this now i'm just going to give up
flaviodesousa has quit [Ping timeout: 246 seconds]
<RX14> use .chars.rindex(offset, &block) in the File methods for now...
<RX14> where this came from is the realization that File assumes windows has *one* path seperator, \
<RX14> it doesn't, it has two
<RX14> so I basically need to go around and define SEPARATORS = {'/'} and use SEPERATORS.includes? everywhere...
<RX14> and set {'/', '\\'} on windows
<FromGitter> <asterite> Ah, yes, that can be annoying
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
<RX14> all those nice string and array methods which break down whan you siddenly say "I want *either* this or this now"
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
alex`` has quit [Ping timeout: 252 seconds]
qard_ has joined #crystal-lang
qard has joined #crystal-lang
qard_ has quit [Client Quit]
qard has quit [Quit: Textual IRC Client: www.textualapp.com]
crystalist32 has quit [Ping timeout: 260 seconds]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
<FromGitter> <codenoid> hi, i cant find the repo for this web https://crystal-lang.org/api/0.24.1/
<FromGitter> <asterite> It's generated from the code comments. Try running make docs on the crystal repo
wontruefree has joined #crystal-lang
jxv has joined #crystal-lang
<FromGitter> <mikeeus> Hey everyone, I'm getting this weird error when I run crystal spec: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Does anyone know what this is, or how I can resolve it? [https://gitter.im/crystal-lang/crystal?at=5a5918b983152df26d63ea7c]
<FromGitter> <Dillybob1992> just curious am i doing this command line correctly? ⏎ for some reason no json is being exported, and in sublime text 3 it's giving me error "NO json object could be decoded"
<FromGitter> <bararchy> Can `Channel.recive` have a timeout ?
handicraftsman has joined #crystal-lang
<FromGitter> <mikeeus> K I got it. it was a problem with a cached spec which is stored at `~/.cache/crystal/<folder-name-based-on-project-path>` on Ubuntu
<RX14> @mikeeus rm -rf ~/.cache/crystal
<RX14> corrupting the cache can happen, usually when you interrupt compilation halfway through.
<RX14> oh wow i'm blind
<FromGitter> <mikeeus> thanks @RX14 ! Clearing the cache worked for me
<FromGitter> <mikeeus> lol just a bit late
<RX14> yeah I just saw you said it
<RX14> I think it's fixable to make the cache more robust
<FromGitter> <mikeeus> Event just a better error message would help
<FromGitter> <mikeeus> like: "Error: Nuke the cache, and you're all good :)"
<RX14> well it's pretty hard to give a better error message there
<RX14> since that error "isn't possible"
<RX14> there's lost of ways the linker can fail, and it's an external program so it's hard to get a program-readable error out of
<FromGitter> <mikeeus> ah I wish I knew more about crystal's inner workings, I would do more to help
<FromGitter> <Dillybob1992> man, having so many problems on sublime text 3 with crystal lang auto format can someone please help
<FromGitter> <bararchy> Can i use the Channel select to somehow simulate timeout?
<RX14> @mikeeus there's a lot of different things in the internals of crystal, which means there's a lot of stuff for different people to work on.
<RX14> the compiler itself is a bit hard to get started but the stdlib is really easy to get working on
<RX14> (and the stdlib is what really needs the most immediate work)
<RX14> @bararchy yes
<FromGitter> <bararchy> RX14 there is like zero docs regarding Channels, how would I use select to simulate timeout ?
<FromGitter> <bararchy> cool thanks :)
<FromGitter> <bararchy> I didn't really understand though what exatcly `select` do in this regard ⏎ It looks like some sort of a `case` statment from the example
<RX14> it is
<RX14> it's case over channels
<RX14> all it does is take the first message from a bunch of channels
<RX14> well
<RX14> it can work with send too
<FromGitter> <bararchy> That's interesting , I'll play around with it
<FromGitter> <bararchy> I wish we had something like `recieve(timeout: 1.minute)`
<FromGitter> <bararchy> Maybe with an option of raise v.s return nil
<RX14> well
<RX14> File's path-hanbdling methods are basically shot on windows
<RX14> I suggest I just delete the whole fiasco of changing File::SEPARATOR on windows
<RX14> and reply on windows accepting \
sz0_ has joined #crystal-lang
sz0_ has quit [Client Quit]
sz0 has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
jxv has quit [Quit: zzz…]
jxv has joined #crystal-lang
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vivus has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 1.9]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> The plan was to be able to use select against a channel and a timeout. It's just not done.
jxv has quit [Ping timeout: 276 seconds]