jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.1 | 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
<travis-ci> manastech/crystal#2378 (master - 4e4e2f3 : Ary Borenszweig): The build was broken.
vikaton has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
havenwood has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
DerisiveLogic has quit [Remote host closed the connection]
vikaton has quit []
waterlink1 has joined #crystal-lang
waterlink has quit [Ping timeout: 256 seconds]
c355E3B has quit [Quit: Connection closed for inactivity]
DerisiveLogic has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
havenwood has joined #crystal-lang
waterlink1 has quit [Ping timeout: 256 seconds]
willl has quit [Quit: Connection closed for inactivity]
havenwood has quit [Ping timeout: 272 seconds]
JBat has joined #crystal-lang
datanoise has joined #crystal-lang
JBat has quit [Quit: Computer has gone to sleep.]
bcardiff has joined #crystal-lang
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 272 seconds]
kulelu88 has quit [Quit: Leaving]
bcardiff1 has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
willl has joined #crystal-lang
bcardiff has quit [Read error: Connection timed out]
zz_Cidan is now known as Cidan
bcardiff has joined #crystal-lang
bcardiff has quit [Read error: Connection timed out]
bcardiff has joined #crystal-lang
havenwood has joined #crystal-lang
Cidan is now known as zz_Cidan
datanoise has quit [Quit: leaving]
bcardiff has quit [Read error: Connection timed out]
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Read error: Connection timed out]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
unshadow has joined #crystal-lang
Ven has joined #crystal-lang
JBat has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
BlaXpirit has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leafybasil has quit [Remote host closed the connection]
JBat has quit [Ping timeout: 240 seconds]
vikaton has joined #crystal-lang
leafybasil has joined #crystal-lang
Ven has joined #crystal-lang
<unshadow> >> a = require "colorize"; b = require "colorize"; puts [a,b]
<DeBot> unshadow: [nil, nil] - more at http://carc.in/#/r/gp
<unshadow> no ture\false ?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> well, it's not like it would make any sense to react to it in Crystal
<jhass> since executed compile time
unshadow has quit [Ping timeout: 256 seconds]
c355E3B has joined #crystal-lang
Ven has joined #crystal-lang
<ddfreyne> When would it make sense to react to that in Ruby?
<strcmp1> donno never see any code in ruby that checked the return value of require
<jhass> yeah, makes sense was wrong I guess, it's not even possible unlike as in ruby
<strcmp1> i think its possible but just not very useful
Ven has quit [Read error: No route to host]
DerisiveLogic has quit [Ping timeout: 258 seconds]
BlaXpirit-UA has joined #crystal-lang
BlaXpirit has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
sandelius has joined #crystal-lang
unshadow has joined #crystal-lang
<unshadow> well it's more of a way to know if you managed to load some libs, in ruby I had a check for a project where the license file was a require, so the check would be false = exit, true = continue
<jhass> eh, true/false indicates whether the file was loaded already or not
<jhass> LoadError is raised if it can't be loaded
<unshadow> Oh ... right it was a begin recue check arounf the require ...
<unshadow> nm then ..
<unshadow> yeha, I guess it isn't useful
<unshadow> a question, why can't a statically compiled binery (that been built on Linux) be used on Windows ?
<unshadow> why wont it work ?
<strcmp1> totally different binary, linux uses ELF and idk what windows uses
<strcmp1> s/different/incompatible/
<jhass> also different syscalls for a lot of stuff
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<unshadow> hm... looking at http://en.wikipedia.org/wiki/Executable_and_Linkable_Format, I can see everything outhere is using ELF, except windows.. would that mean a static bin will work on android if i'll compile it to ARM ?
<jhass> Android uses the linux kernel, so if you hit the architecture, chances are good
<unshadow> Is there a way for me to compile a Crystal lib into .so format ? so that a Ruby FFI can be integrated around it ? (Sorry if the question is stupid)
<jhass> I never tried, but if you use --single-module, fish the .o out of .crystal and link it manually into an .so you might have chances. You'll also need to provide an interface with fun's
<jhass> using libruby to bind crystal functions to ruby methods might be easier
<jhass> have a look at this old Poc https://github.com/manastech/crystal_ruby
<unshadow> Interesting, I assume that for creating a whole project one would be required to extend this lib_ruby binding quite alot.
<unshadow> But it does looks like a nice idea
bcardiff has joined #crystal-lang
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
JBat has joined #crystal-lang
willl has joined #crystal-lang
bcardiff1 has joined #crystal-lang
<unshadow> If I create a parser, which can parse written text, act uppon it and create an executable from it (ie. crystal code the builds code dynammicaly, and compile that code) that means I built a compiler ?
bcardiff has quit [Ping timeout: 276 seconds]
<jhass> a special case of it, commonly referred to as transpiler
<jhass> e.g. coffeescript is one
<epitron> jhass: hmm... you could use the tests for the return value of 'require' as a way of conditionally compiling some codepaths
<epitron> like, if the user has some library, then some features are enabled
<unshadow> but if he dosn't has it, you will get a LoadError, so it's better to condition it on begin rescue then on the return value which can only return true (or false if it was alreay loaded)
<jhass> in Ruby the idiom for that is to check whether thing I want to call is defined
<epitron> oh, sorry, yeah :)
<epitron> i forgot what require's return value meant
<jhass> config.insert_middleware FooBar if const_defiend? FooBar
<epitron> yeah...
vikaton has quit []
<unshadow> jhass: http://en.wikipedia.org/wiki/Source-to-source_compiler cool :) you are like a walking wikipedia hahah
<epitron> strange that OMeta isn't mentioned there anywhere
<epitron> OMeta is a language for creating source translators
<epitron> if you only use a subset of the transformation rules, it can be run backwards for automatic source-to-source translation from a single definition
strcmp1 has quit [Ping timeout: 255 seconds]
sandelius has joined #crystal-lang
vikaton has joined #crystal-lang
jua_ has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vkUMe
<crystal-gh> crystal/master 2ece935 Ary Borenszweig: Removed the "implicitly include generic module" rule: explicit is better than implicit and will lead to less confusion. It's also easier to implement.
<crystal-gh> crystal/master 3034ebb Ary Borenszweig: Updated Changelog
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shama has joined #crystal-lang
<travis-ci> manastech/crystal#2379 (master - 3034ebb : Ary Borenszweig): The build was fixed.
strcmp1 has joined #crystal-lang
zz_Cidan is now known as Cidan
asterite has joined #crystal-lang
<jhass> asterite: mmh, I think we need to find a way to improve the error message of this http://carc.in/#/r/h6
<jhass> there's a good dozen attempts of it now
<asterite> jhass: how would you improve it?
sandelius has joined #crystal-lang
<asterite> By the way, how do I give you op? So you can change the subject :-)
<jhass> permanently? let me check, I think only waj can atm
<jhass> yup
<jhass> you need to tell waj to give you +F ;)
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vkTkg
<crystal-gh> crystal/master 6276a27 Ary Borenszweig: Added Tuple from_json and to_json
<asterite> Oh, wait
asterite has quit [Client Quit]
asterite has joined #crystal-lang
<jhass> that won't help ;)
<asterite> jhass: really? :(
<jhass> you'll need +f in the chanserv acl
<asterite> Well, we'll have to wait
<asterite> How to improve that error message?
<jhass> check /msg ChanServ access #crystal-lang list
<jhass> and /msg ChanServ help flags
<jhass> I'm not sure, can we detect it happened on an instance variable that is a union with nil and suggest to assign it to a local?
strcmp1 has quit [Remote host closed the connection]
<jhass> like appending "(perhaps you need to assign @foo to a local variable?)" in that case
<asterite> Oh, sure, we can do that. But note that the error is because of @var1, not @var2
<asterite> (well, when you fix @var1 it will also happen because of @var2)
<jhass> yeah sure
<jhass> getting closer :D
<asterite> Wow, I didn't know it tells you the error for @var2 too, I thought it only was for the receiver. Apparently I forgot about this :-P
<asterite> I think I can check if that variable was assigned in the method's body and give a better error message
<asterite> like what you suggest
<asterite> could you open an issue/enhancement so I don't forget?
<jhass> sure
<asterite> I usually don't get those errors because I'm aware of that limitation, but for newcomers it will surely help
<jhass> btw do you remember why you went with #crystal-lang instead of #crystal?
<jhass> yes, that's why I bring it up, I can easily imagine it'll be the most common pitfall
<asterite> jhass: can't remember, I think waj got it
<jhass> #crystal is registered but unused, so if you write a mail to projects@freenode.net you'll likely get it. Would prevent from another project thinking it's a good idea to use the same name to snap it :P
<jhass> we can then just let it forward here for example
<asterite> Can anyone write that email?
BlaXpirit-UA has quit [Quit: Quit Konversation]
<asterite> Mmm... what do I say, that we have this language and we'd like that channel for us?
BlaXpirit has joined #crystal-lang
<jhass> yes, just that. And no, you need to prove affiliation with a project that uses that name
<jhass> linking https://github.com/manastech/crystal/graphs/contributors and sending the mail from the address you have at https://github.com/asterite should be enough ;)
<asterite> jhass: sent!
<asterite> I heard you won't be coming to Curry On ;-(
<jhass> no, sorry :/
<travis-ci> manastech/crystal#2380 (master - 6276a27 : Ary Borenszweig): The build passed.
<asterite> jhass: oh, just now I see the issue about nil, I didn't know why you was bringing this just now :-P
<asterite> Too bad, we really wanted to meet you personally!
<jhass> maybe some other conf when my private life has settled a bit ;)
<asterite> ok :-)
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass> http://carc.in/#/r/i1 mmh, that one's a bug, isn't it?
<asterite> Not sure, there's @var1 = @var1 || 0
<asterite> so you are reading @var1 before assigning to it, so the compiler treats it as nilable
<asterite> I don't know if it really matters, why not assign to @var1 directly?
asterite has quit [Quit: Page closed]
<jhass> oh, crystal doesn't rewrite a ||= b to a || a = b ?
<willl> even if it does, the first part to check for falsyness might count as reading?
sandelius has joined #crystal-lang
<jhass> yes, but that's not troublesome reading
<jhass> for that reading it was nilable, but I'd expect the later assignment in the constructor to make it not nilable for the further cases
<jhass> only passing out self in the constructor prior that assignment would cause that
<willl> yeah it seems like this case would be possible to reason out that it is never actually nil
asterite has joined #crystal-lang
<asterite> jhass: you are right, it's a ||= b ==> a || a = b
<asterite> but still, if the compiler sees that an instance variable is used (read) before it was assigned a value, regardless of what you do with it (i.e., a nop), it will treat it as nilable
<asterite> we could improve it, but I'm not sure it's worth it
asterite has quit [Client Quit]
<jhass> yeah, I guess I thought checking whether the constructor has an assignment that makes it non-nilable (and none afterwards that makes it nilable) might be not too hard, but it's probably not too important either
kulelu88 has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
strcmp1 has joined #crystal-lang
JBat has quit [Quit: Computer has gone to sleep.]
<vikaton> I'm getting a (23) Failed writing body while seting up the repo to install crystal
<vikaton> and reason why?
<jhass> quirk in the network? try again
<vikaton> jhass, same error
<vikaton> you try?
<jhass> doing what exactly?
<jhass> loads fine
<jhass> maybe there's something helpful in curl -v http://dist.crystal-lang.org/apt/setup.sh
<vikaton> jhass, works
<vikaton> jhass, but still errors on the first one
<jhass> huh
<vikaton> :/
<jhass> well, just execute the commands you see there then
<vikaton> I recently just updated to Debian 8
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
vikaton has quit []
leafybasil has quit [Remote host closed the connection]
jua_ has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
tdc has joined #crystal-lang
bcardiff1 has quit [Quit: Leaving.]
vikaton has joined #crystal-lang
<vikaton> /usr/bin/ld: cannot find -lssl - /usr/bin/ld: cannot find -lcrypto
<vikaton> what packages do I need for those errors to be fixed?
sandelius has joined #crystal-lang
<kulelu88> you need no systemd
<vikaton> kulelu88: wait what?
<kulelu88> joke 0/
<vikaton> o
<vikaton> well
<jhass> openssl
<jhass> (possibly -dev)
<jhass> or was it libssl? debian fucks it all up
<vikaton> it says I already have lib ssl
<jhass> -dev ?
<vikaton> o wow it was libssl-dev
<vikaton> pft
<kulelu88> sounds like you need -dev packages to build crystal
<jhass> debian managed to break linking stuff unless you install the -dev package
leafybasil has joined #crystal-lang
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
DerisiveLogic has joined #crystal-lang
tdc has quit [Quit: Leaving]
wanderer_ has joined #crystal-lang
<wanderer_> jhass: hey, I need you advice on oop again :)
<wanderer_> STDOUT is created in main.cr via `AutoflushBufferedIO.new(FileDescriptorIO.new(1, blocking: LibC.isatty(1) == 0))`
<wanderer_> I added `class MyClass < FileDescriptorIO; def <<(obj); LibC.printf("hello"); super; end; end;` and changed STDOUT to `AutoflushBufferedIO.new(MyClass.new(1, blocking: LibC.isatty(1) == 0))`
<wanderer_> now I kinda expect `puts "bla"` to print "hello" as well, which it does not :s
<jhass> I bet AutoflushBufferedIO doesn't use << on the passed IO
<wanderer_> doesn't the global puts call STDOUT.puts?
<wanderer_> which then calls << ?
<jhass> yes, but AutoflushBufferedIO is using composition here, not inheritance
<jhass> (well, BufferedIO does, which AutoflushBufferedIO is a subclass of)
<jhass> the contract for IO is something like read and write I think
<jhass> so IO is included into BufferedIO, which takes another IO-like object and wraps (not overloads!) the read and write calls
<jhass> so BufferedIO implements IOs contract again (read/write) and delegates to the IO passed in its constructor
<jhass> so for the IO you pass in the constructor, BufferedIO will never call <<, just read/write (and .fd, .rewind, .flush .to_fd_io apparently, sigh)
<jhass> does that make any sense to you? :)
<ddfreyne> Topic needs update! It still mentions 0.7.1.
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<wanderer_> "yes, but AutoflushBufferedIO is using composition here, not inheritance" omg, yes, that's why I actually called STDOUT.to_io_fd.handle, instead of STDOUT.handle, after I noticed it doesn't inherit
<willl> @jhass http://carc.in/#/r/jv
<jhass> willl: yeah, I briefly checked if there's a way to construct a String without copying the buffer, but doesn't seem so
<jhass> oh btw, cstr will probably be dropped in favor of to_unsafe
<willl> ah okay. Just using that to approximate in benchmarks what you have from the driver
<wanderer_> << is implemented via obj.to_s(io) which calls io.write()
<jhass> yeah
<wanderer_> however, the << from BufferedIO gets called, not the FileDescriptorIO's one, got it now
<jhass> yup
<vikaton> Any help with the following Nill problem? https://gist.github.com/Vikaton/14f9087d9eee8b61cf8e
<jhass> so STDIN << -> BufferedIO#<< -> Object#to_s(BufferedIO) -> BufferedIO#write -> FileDescriptorIO#write
<jhass> vikaton: why not two spaces :(
<wanderer_> so should I use `class MyClass < BufferedIO` instead?
<vikaton> jhass: I swear github messes it up for me, I SWEAR
<jhass> it means you use hard tabs instead of soft tabs
<vikaton> im a hardcore type of person
<jhass> wanderer_: yes, but probably not what you want
<vikaton> jhass: at least i took ur advice of not being root today when I updated to dEbian 8
<wanderer_> hardtabs 8 chars :)
<wanderer_> jhass: I want to "hook" everything that gets written via STDOUT and STDERR
<jhass> wanderer_: overload write
<wanderer_> thanks, that's what I just wanted to try, but why did you say it's probably not what I want?
<jhass> huh? you said you want to subclass BufferedIO
<jhass> look at the chain I wrote, you want to overload the FileDescriptorIO#write
<wanderer_> ah, yeah thanks
<wanderer_> my bad
<vikaton> jhass, I did not have this error before tbh, happened when I updated
<jhass> yeah, updates might change stuff
<vikaton> well yes, but idk how2 fix at this point
<wanderer_> btw where does the approach << uses actually come from? at first I thought it'd look like `write(obj.to_s)` instead of the `obj.to_s(self)`
<jhass> wanderer_: it's to avoid string allocations
<wanderer_> is it a widely used pattern or just common sense?
<jhass> vikaton: you check whether it's nil and only do the gsub if not
<jhass> widely used in Crystal, widely used beyond? no idea, I don't think so
<jhass> not sure I'd call it common sense, pretty sure asterite benchmarked stuff and figured, "darn, I need to get rid of all these temporary strings"
<vikaton> jhass, does this process involve using not_nil! ?
<jhass> vikaton: depends on the behavior you want
<jhass> it might as well involve Object#try or the if statement
<vikaton> sigh :[
<vikaton> jhass, so I shoudl encase the whole with with an if staerment and executing that if that hash is not nil?
<wanderer_> good night everyone & danke für deine hilfe, jhass
<jhass> there's no hash
<jhass> wanderer_: yw
wanderer_ has quit [Quit: Page closed]
<jhass> at least in your code there's none
<vikaton> jhass, req.get is a hash
<jhass> no, a ParameterHash
<vikaton> o.0
<jhass> I linked it
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
<vikaton> jhass, either way, should I have an if statement that checks if req.get == Nil
<jhass> check again, is the #[] called on nil?
<vikaton> No
<vikaton> sigh
<vikaton> I'm stumped :(
<jhass> so what is it that may return nil?
<jhass> we ruled out .get
<vikaton> .fetch
<jhass> I don't see a direct call to fetch in the line that's throwing the error
<vikaton> oh ithought u meant in general
<vikaton> jhass: the binary key
<jhass> well, more specifically the call to the #[] method
<vikaton> Ok
<jhass> on which you chain the .gsub call
<vikaton> mhm
<jhass> remeber, foo[bar] is just syntax sugar for foo.[](bar)
<vikaton> ok
<vikaton> i think im missing the big picture
bcardiff has joined #crystal-lang
bcardiff1 has joined #crystal-lang
bcardiff has quit [Read error: Connection reset by peer]
BlaXpirit has quit [Quit: Quit Konversation]
<vikaton> ehh jhass
vikaton has quit []
vikaton has joined #crystal-lang
<vikaton> sorry for the dc if u said anything jhass
Codcore has joined #crystal-lang
<jhass> I didn't
<vikaton> 0k good
bcardiff1 has quit [Ping timeout: 252 seconds]
AndChat|505 has joined #crystal-lang
<vikaton> jhass, still no luck :[
AndChat|505 has quit [Ping timeout: 245 seconds]
Codcore has quit [Ping timeout: 246 seconds]