jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.3 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
flaviu has joined #crystal-lang
flaviu has left #crystal-lang [#crystal-lang]
flaviu has joined #crystal-lang
datanois1 has quit [Ping timeout: 250 seconds]
jtarchie has quit [Quit: Connection closed for inactivity]
NeverDie has joined #crystal-lang
mdz_ has joined #crystal-lang
datanois1 has joined #crystal-lang
mdz_ has quit [Ping timeout: 252 seconds]
vikaton has joined #crystal-lang
Cidan is now known as zz_Cidan
shama has quit [Remote host closed the connection]
shama_ has joined #crystal-lang
waj has quit [Quit: waj]
waj has joined #crystal-lang
shama_ has quit [Remote host closed the connection]
waterlink1 has joined #crystal-lang
waterlink has quit [Ping timeout: 255 seconds]
shama has joined #crystal-lang
shama has quit [Remote host closed the connection]
<waj> will: after travis guys (hopefully) merge your PR, that means we can start using “language: crystal” or we need to wait until they deploy it?
waterlink1 has quit [Ping timeout: 244 seconds]
mdz_ has joined #crystal-lang
<vikaton> hey waj
<vikaton> not particularly meant for you, but does Crystal have pragmas?
mdz_ has quit [Ping timeout: 246 seconds]
<waj> you mean like parser directives?
<vikaton> waj, yeah
<waj> there is `ifdef`
<waj> what are you trying to do?
<vikaton> waj, nothing, I was wondering if Crystal had something similar to http://nim-lang.org/docs/manual.html#pragmas
<waj> I see. There are some attributes, like “Raises” and “NoInline”
<vikaton> I see. waj, any news on inline assembly?
<waj> Not yet. I’d like to have that so we could implement more efficient coroutines ;-)
<vikaton> Nice
shama has joined #crystal-lang
havenwood has joined #crystal-lang
vikaton has quit []
endou_________ has quit [Remote host closed the connection]
n1ftyn8 has quit [Remote host closed the connection]
willl has quit [Remote host closed the connection]
mdz_ has joined #crystal-lang
mdz_ has quit [Ping timeout: 265 seconds]
havenwood has quit [Ping timeout: 250 seconds]
asterite has joined #crystal-lang
waj has quit [Quit: waj]
asterite has quit [Quit: Leaving.]
havenwood has joined #crystal-lang
asterite has joined #crystal-lang
asterite has quit [Quit: Page closed]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
ryanf has quit [Ping timeout: 244 seconds]
ryanf has joined #crystal-lang
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
NeverDie has quit [Quit: Textual IRC Client: www.textualapp.com]
Liothen has joined #crystal-lang
mdz_ has joined #crystal-lang
mdz_ has quit [Remote host closed the connection]
qb has quit [Ping timeout: 265 seconds]
qb has joined #crystal-lang
datanois1 has quit [Ping timeout: 258 seconds]
datanois1 has joined #crystal-lang
BlaXpirit has joined #crystal-lang
willl has joined #crystal-lang
<willl> waj: I'm not sure what the delta between merge and deploy travis has
n1ftyn8 has joined #crystal-lang
datanois1 has quit [Ping timeout: 246 seconds]
unshadow has quit [Quit: leaving]
endou_________ has joined #crystal-lang
mdz_ has joined #crystal-lang
mdz_ has quit [Ping timeout: 258 seconds]
emmanueloga has quit [Ping timeout: 272 seconds]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
me has joined #crystal-lang
me is now known as Guest55372
Ven has joined #crystal-lang
emmanueloga has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
unshadow has joined #crystal-lang
mdz_ has joined #crystal-lang
mdz_ has quit [Ping timeout: 264 seconds]
<unshadow> Lets say I have this array: ["cooldata", "notsomuch", "cooldata", "dontcare"], I want only the cooldata out of it, untill now I used something like "a,dummy,b,dummy = Array" but maybe there is something better out there ?
alsm has joined #crystal-lang
<jhass> what's the criteria? every second element?
<jhass> specific indexes?
<unshadow> I usually do this for this: dummy, remote_port, dummy, remote_ip = socket_source.to_io.peeraddr
<unshadow> I dont care about fammily and local port
<unshadow> so I want only the 2nd and 4th parameters
<jhass> I usually do _local_port, remote_port, _family, remote_ip =, since I find it clearer, I communicate both that I don't want the data and what it is that I don't care about
<jhass> but you can do remote_port, remote_ip = ...values_at(1, 3)
<unshadow> >> _a = 5; puts _a
<DeBot> unshadow: 5 - more at http://carc.in/#/r/2ic
<unshadow> lets say this is something that can be inside a massive loop, so I dont want to save to memory unnecery stuff
<unshadow> If I could I would do /dev/null, save_this, /dev/null, save_this_too = Array
<jhass> I'd hope that the optimizer is smart enough to throw away variables that are never read
<jhass> but see above, values_at
<unshadow> values_at sounds cool
<unshadow> >> a = [1,2,3,4]; puts a.values_at(0,3)
<DeBot> unshadow: {1, 4} - more at http://carc.in/#/r/2id
<unshadow> is that also Ruby syntax ?
Ven has joined #crystal-lang
<jhass> yes, though there it allocates an extra array
<unshadow> k, thanks :)
Ven has quit [Client Quit]
Guest55372 has quit [Remote host closed the connection]
willl has quit [Quit: Connection closed for inactivity]
c0r5um has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<unshadow> Is there a way to force String encode ?
<jhass> no, Crystal is not encoding aware yet
<unshadow> hmm ok
<unshadow> if so, how can it check ascii_only? \
<jhass> mmh
<jhass> >> 'a' < 127
<DeBot> jhass: Error in line 4: no overload matches 'Char#<' with types Int32 - http://carc.in/#/r/2io
<jhass> >> 'a'.ord < 127
<DeBot> jhass: # => true - http://carc.in/#/r/2ip
<jhass> >> 'ä'.ord < 127
<DeBot> jhass: # => false - http://carc.in/#/r/2iq
<jhass> chars.all? {|c| c.ord <= 127 } or whatever the range was
<unshadow> >> 'ש'.ord < 127
<DeBot> unshadow: # => false - http://carc.in/#/r/2ir
<unshadow> I see, so basicly everything lower then 127 is ASCII right ?
<jhass> man ascii
<jhass> UTF-8 is fully ASCII compatible
<jhass> so <= 127 or < 128
ponga has joined #crystal-lang
<unshadow> >> '�'.ord
<DeBot> unshadow: # => 65533 - http://carc.in/#/r/2is
<unshadow> >> 'ש'.ord
<DeBot> unshadow: # => 1513 - http://carc.in/#/r/2it
<unshadow> jhass: I found my issue with the socket.read stuff
<unshadow> apperently there is a bug or something with print
<unshadow> when calling STDOUT.flush manually after print the issue is resolved
rilut has joined #crystal-lang
me has joined #crystal-lang
me is now known as Guest15513
<jhass> you're still on 0.7.2?
<unshadow> Crystal 0.7.3 [4719644] (Tue Jun 9 06:55:41 UTC 2015)
<jhass> mh
<jhass> it should flush on \n
Ven has joined #crystal-lang
<unshadow> print wotn add \n, maybe this is the issue ?
<unshadow> *wont
<jhass> oh there's none in the response either?
<unshadow> Nope :) it's waiting for a response mid line
<jhass> meh
<unshadow> like Username:
<unshadow> or something
<jhass> I'm still not sure it's a good idea, but expected atm
<unshadow> TBH it should flush after print is called, always
<jhass> well sometimes it's useful to do things like printing single chars in a loop
<jhass> maybe we can do IO#sync like ruby
<jhass> IO#sync= I mean
<jhass> idk
<unshadow> so you can configure the flush behaivior ?
<jhass> yeah
<unshadow> cool, it looks good (http://ruby-doc.org/core-2.2.2/IO.html#method-i-sync) for me this will solve it
<unshadow> BTW, why does ruby print flushes after call then ? on default
<unshadow> maybe sync should default to true, unless specificly configured not to
<jhass> maybe only for stdout, idk
rilut has quit [Quit: Page closed]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BlaXpirit has quit [Quit: Quit Konversation]
<unshadow> is there a super-type for Int ? as in can I check Int32 and Int64 like a.is_a?(Int(both 32 and 64)) ?
<unshadow> in both I mean or
<jhass> yes, Int
<jhass> and above that is Number I believe which includes Float (and Bignum I guess?)
<unshadow> >> 3.is_a?(Int)
<DeBot> unshadow: # => true - http://carc.in/#/r/2iu
<unshadow> >> 3.is_a?(Int32)
<DeBot> unshadow: # => true - http://carc.in/#/r/2iv
<unshadow> >> 3.is_a?(Number)
<DeBot> unshadow: # => true - http://carc.in/#/r/2iw
<unshadow> cool thanks
<unshadow> DeBot is the shizzle
strcmp1 has quit [Remote host closed the connection]
strcmp1 has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Client Quit]
strcmp1 has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
strcmp1 has joined #crystal-lang
datanois1 has joined #crystal-lang
<unshadow> jhass: did you move the AUR packages ? www.phoronix.com/scan.php?page=news_item&px=Arch-AUR-Git-Move
<jhass> yes
<unshadow> cool :) good job for remmbering hahah
<unshadow> wow, you got lots of packages
<jhass> it accumulates over time
<jhass> I never sudo make install
<unshadow> XD
<unshadow> it's a good practice
<ponga> hi jhass
<jhass> hi
<jhass> btw aur4 has support for co maintainers
<jhass> if anyone wants to co-maintain crystal, I'm very open to that
<unshadow> jhass: I'll help, if you want
<jhass> it's not like there's much work, but say if I'm without internet for a few weeks for whatever reason that might be good
<unshadow> jhass: btw, datanoise said to use "print!" to force a flush
<jhass> I've seen it
<jhass> unshadow: cool, added you (it doesn't display weirdly enough)
<unshadow> Didn't know we had that option XD though usually I dont like to use methods with "!", usually like gsub! or split! etc..
<unshadow> jhass: If you want I can update the build of crystal-git0.7.2 to 0.7.3
<jhass> oh right, I forgot to bump the precompiled binary it uses, feel free
<jhass> then I can try out git subtree pull :D
waj has joined #crystal-lang
strcmp1 has quit [Ping timeout: 246 seconds]
strcmp1 has joined #crystal-lang
bcardiff has joined #crystal-lang
NeverDie has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mdz_ has joined #crystal-lang
mdz_ has quit [Ping timeout: 264 seconds]
willl has joined #crystal-lang
<unshadow> What does this error means: "Invalid byte sequence in UTF-8 string"
<jhass> that you read something that's not valid UTF-8
<unshadow> Damn... and I cann't force encoding :(
bcardiff has quit [Quit: Leaving.]
havenwood has joined #crystal-lang
strcmp1 has quit [Quit: Leaving]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<unshadow> >> puts {username: "blabla", password: "blabla"}
<DeBot> unshadow: Syntax error in eval:4: unexpected token: : - http://carc.in/#/r/2jd
<unshadow> >> puts {username => "blabla", password => "blabla"}
<DeBot> unshadow: Syntax error in eval:4: unexpected token: => - http://carc.in/#/r/2je
<jhass> you need the ()
<jhass> it's interpreted as a block this way
mdz_ has joined #crystal-lang
<unshadow> >> a = {key1: "test", key2: "testing"}; p a
<DeBot> unshadow: {:key1 => "test", :key2 => "testing"} - more at http://carc.in/#/r/2ji
<unshadow> >> a = {key1: "test", key2: "testing"}; p a[:key1]
<DeBot> unshadow: "test" - more at http://carc.in/#/r/2jk
Guest15513 has quit [Remote host closed the connection]
bcardiff has joined #crystal-lang
Ven has joined #crystal-lang
me has joined #crystal-lang
me is now known as Guest13716
asterite has joined #crystal-lang
<asterite> unshadow: you can do STDOUT.write(buf.to_slice, len); STDOUT.flush
<asterite> instead of creating a string and then printing it... in the aeon client reader loop, I mean
<asterite> that will be faster and won't check for UTF-8, just read and print whatever comes
<asterite> Yesterday I spoke with waj, we
<asterite> we'll make FileDescriptorIO buffered... probably turn BufferedIO into a module that you can include in an IO to make it buffered. And I guess there will be #sync, but not sure.
<asterite> That means File, Socket and STD* will be buffered by default
<unshadow> asterite: what will it mean "buffered" how will it behave differently from now ?
<asterite> Well, when you do File.open(...) it's not buffered at all, each time you read a byte it does a syscall (or at least invokes the read C function)
<asterite> with buffered, you read large chunks into a temporary buffer and reading by byte is much faster
<asterite> Right now you have to do BufferedIO.new(File.open(...)) but that's cumbersome, and probably %99 of the time you want that buffered because otherwise it's too slow
<asterite> unshadow: why do I get those question marks in the aeon client in crystal, but no in telnet?
<asterite> Is telnet a protocol other than read/write whatever comes? Maybe those question marks mean something in the protocol
<asterite> we also found that C#'s FileStream is buffered... but not in Java. Which makes sense, because Java is very beaurocratic, but C# is not
<unshadow> asterite: Thats a good question, it seems that maybe they know when a telnet client is connected and dont send any extra info, I'm trying to find this out with the developer, maybe though, telnet just enforces some kind of encoding ?
<unshadow> asterite: the BufferedIO changes sounds promising, It looks like it could help alot to speed up read\write by default.
<asterite> Well, telnet seems to be a protocol: http://en.wikipedia.org/wiki/Telnet
<unshadow> All data octets except 0xff are transmitted over Telnet as is. -- Wikipedia
<unshadow> dosn't that means it's just strings ?
<unshadow> asterite: Hm... using Netcat, which is a raw TCP client, I also get those question marks and other non-assci stuff, apperently those are indeed telnet symbols or something
<unshadow> good thing that jhass said he will create a Telnet::Parser module
<unshadow> ;)
<jhass> heh
<unshadow> (joking)
<jhass> telnet is an aweful protocol
<jhass> worse than IRC
<unshadow> are there alot of escape letter to be parsed ?
<jhass> read through it
<jhass> "Telnet command structure" is my favorite chapter
<unshadow> Yeha, Ruby got it in the STDLIBS
<unshadow> LOL written at " May 1983" ... damn
jtarchie has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
unshadow has quit [Quit: leaving]
c0r5um has quit [Quit: Quitte]
BlaXpirit has joined #crystal-lang
unshadow has joined #crystal-lang
<unshadow> TBH it seems playable with only text output , maybe i should just read each char , check that i's ASCII and only then print it
strcmp1 has joined #crystal-lang
Codcore has joined #crystal-lang
<Codcore> How to make macro ecr_file to work with relational path? It works only when I specify absolute system path to file...
<asterite> You can do "#{__DIR__}/..."
<asterite> __DIR__ gives you the file's directory
<asterite> Hm, that's missing from the docs, I'll add it later
<Codcore> asterite, thanks
<Codcore> asterite, can you look please, if I using ecr_file correctly - http://play.crystal-lang.org/#/r/2k5
<Codcore> error is normal, since ecr file doesn't exist
<Codcore> at my machine it works
<asterite> Codcore: seems to work on my machine if I create a view.ecr next to that file
<Codcore> asterite, thanks!
unshadow has quit [Ping timeout: 264 seconds]
datanois1 is now known as datanoise
_unshadow_ has joined #crystal-lang
<_unshadow_> So , basically I need to convert this to Crystal http://docs.ruby-lang.org/en/2.0.0/Net/Telnet.html#method-i-preprocess
asterite has quit [Ping timeout: 246 seconds]
shama has joined #crystal-lang
unshadow has joined #crystal-lang
_unshadow_ has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 246 seconds]
<unshadow> >> IAC = 255.chr; puts IAC
<DeBot> unshadow: ÿ - more at http://carc.in/#/r/2kf
<unshadow> >> puts "\000"
<DeBot> unshadow:
<unshadow> >> puts "ab\000ab"
<DeBot> unshadow: ab
<unshadow> >> puts "ab\000 ab"
<DeBot> unshadow: ab
n0xff has joined #crystal-lang
AckZ has joined #crystal-lang
<unshadow> The things you see when going over a very very old and unsed STDLIB code elsif AYT == $1 # respond to "IAC AYT" (are you there)
<unshadow> self.write("nobody here but us pigeons" + EOL)
<jhass> hehe
<unshadow> >> "testing" =~ /bla/no
<DeBot> unshadow: Syntax error in eval:4: unknown regex option: n - http://carc.in/#/r/2kj
<unshadow> >> "testing" =~ /bla/o
<DeBot> unshadow: Syntax error in eval:4: unknown regex option: o - http://carc.in/#/r/2kk
NeverDie has quit [Quit: Textual IRC Client: www.textualapp.com]
NeverDie has joined #crystal-lang
<unshadow> >> "testing" =~ /bla/O
<DeBot> unshadow: Syntax error in eval:4: unknown regex option: O - http://carc.in/#/r/2kl
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
vikaton has joined #crystal-lang
alsm has quit [Ping timeout: 256 seconds]
n0xff has quit [Remote host closed the connection]
Dreamer3 has quit [Read error: Connection reset by peer]
Dreamer3 has joined #crystal-lang
waj has quit [Quit: waj]
<Codcore> Sorry for the annoyance, but can anybody explain why ecr_file macro don't expanding as I expected - https://gist.github.com/Codcore/bf2d894570398db07ea1 ?
Codcore_ has joined #crystal-lang
Codcore_ has quit [Client Quit]
rpitt has joined #crystal-lang
rpitt has quit [Client Quit]
DeBot has quit [Ping timeout: 272 seconds]
zz_Cidan is now known as Cidan
unshadow has quit [Remote host closed the connection]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
asterite has joined #crystal-lang
<asterite> Codcore: ecr_file is a macro, it accepts an AST node
<asterite> so you are passing a string interpolation
<asterite> you can't have a view file that depends on runtime values with ECR
sandelius has joined #crystal-lang
<Codcore> @asterite, thanks
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
asterite has quit [Quit: Page closed]
vikaton has quit [Quit: Connection closed for inactivity]
sandelius has joined #crystal-lang
<jhass> >> "foo\nbar\nbaz".match(/^bar$/)
DeBot_ has joined #crystal-lang
DeBot_ has quit [Client Quit]
DeBot has joined #crystal-lang
<jhass> >> "foo\nbar\nbaz".match(/^bar$/)
<DeBot> jhass: # => nil - http://carc.in/#/r/2le
<jhass> mmh
<jhass> >> "foo\nbar\nbaz".match(/^bar$/m)
<DeBot> jhass: # => nil - http://carc.in/#/r/2lf
<jhass> weird
<jhass> >> "bar".match(/\Abar\z/m)
<DeBot> jhass: # => #<MatchData "bar"> - http://carc.in/#/r/2lg
<jhass> >> "bar\n".match(/\Abar\z/m)
<DeBot> jhass: # => nil - http://carc.in/#/r/2lh
<jhass> >> "bar\n".match(/\Abar$/m)
<DeBot> jhass: # => #<MatchData "bar"> - http://carc.in/#/r/2li
<jhass> >> "bar\nbaz".match(/\Abar$/m)
<DeBot> jhass: # => nil - http://carc.in/#/r/2lj
willl has quit [Quit: Connection closed for inactivity]
havenwood has joined #crystal-lang
endou_________ has quit [Read error: Connection reset by peer]
endou_________ has joined #crystal-lang
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
<ponga> >> 10.times.to_a
<DeBot> ponga: # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - http://carc.in/#/r/2lp
<ponga> >> 10.times.to_a.rotate
<DeBot> ponga: Error in line 4: undefined method 'rotate' for Array(Int32) - http://carc.in/#/r/2lq
mdz_ has quit [Remote host closed the connection]
Codcore has quit [Ping timeout: 246 seconds]
sgo has quit [Ping timeout: 258 seconds]
kulelu88 has joined #crystal-lang
sgo has joined #crystal-lang
bcardiff1 has quit [Quit: Leaving.]
Guest13716 has quit [Remote host closed the connection]
havenwood has quit [Read error: Connection reset by peer]
mdz_ has joined #crystal-lang
waterlink has joined #crystal-lang
BlaXpirit has quit [Quit: Quit Konversation]
genixefr has joined #crystal-lang
sgo has quit [Ping timeout: 264 seconds]
havenwood has joined #crystal-lang
waj has joined #crystal-lang
genixefr has quit [Ping timeout: 245 seconds]
wuehlmaus has quit [Ping timeout: 256 seconds]
mdz_ has quit [Remote host closed the connection]
wuehlmaus has joined #crystal-lang
wuehlmaus is now known as Guest93295
bcardiff has joined #crystal-lang
genixefr has joined #crystal-lang
mdz_ has joined #crystal-lang
vikaton has joined #crystal-lang
<vikaton> asterite, any word on the macro extention ?
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
asterite has joined #crystal-lang
<asterite> vikaton: Yes. Allowing more flexibility isn't always good
<asterite> Also, you didn't say how to solve the ambiguity of "foo bar baz"
<vikaton> hmm
<asterite> I also don't understand why you always want so many features from Nim into Crystal
<vikaton> because I like Nim features, but also really like Ruby
<asterite> What other examples of infix operators out there?
mdz_ has quit [Remote host closed the connection]
<asterite> I mean, the "and" example isn't very good, you can use "&&"
<asterite> The "and" would be redundant and people will have to learn two syntaxes for the same purpose
<asterite> (but this is just my opinion, obviously Nim considers that to be ok)
<vikaton> asterite: it was just a suggestion, if you dont want to implement it for your own reasons its fine
<vikaton> asterite: on a totally unrelated topic, you follow Messi?
<asterite> The football player? :-P
<vikaton> yes haha
<asterite> I just don't want to add too many features to the language, I'd like to keep it simple
jbomo has joined #crystal-lang
<asterite> Mmm... I'm not into football, even though I'm from Argentina and that would seem a paradox :-)
<asterite> but I do watch the world cup... it's almost inevitable her
<asterite> e
<vikaton> haha
<asterite> where are you from?
<vikaton> oh im very sorry for your loss at the finals :(
<vikaton> I'm from America :P
<vikaton> but I follow alot of soccer (football)
<asterite> USA?
<vikaton> yeah
<vikaton> I should have probably been more clear about that haha
<asterite> :-)
<asterite> It's because I'm from America too ;-)
<asterite> I never understood why USA calls its country America... it's a continent
<vikaton> Yeah well, we do have a big ego :D
<asterite> My brother does watch a lot of soccer, and he's a programmer too
<vikaton> does he program in Crystal? :P
<asterite> No... he programs in Java, and I think in XML
<asterite> (yes, you read well)
havenwood has joined #crystal-lang