jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | 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
Oliphaunte has quit [Remote host closed the connection]
icezimm has quit [Quit: Leaving.]
paulcsmith_ has joined #crystal-lang
paulcsmith_ has quit [Client Quit]
pawnbox_ has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Read error: Connection reset by peer]
Oliphaunte has joined #crystal-lang
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Philpax has quit [Ping timeout: 252 seconds]
pawnbox has quit [Ping timeout: 252 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
Oliphaunte has quit [Remote host closed the connection]
kulelu88 has quit [Quit: Leaving]
willl has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
akwiatkowski has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 244 seconds]
pawnbox has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
willl has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
matp has quit [Remote host closed the connection]
soveran has quit [Ping timeout: 244 seconds]
matp has joined #crystal-lang
<txdv> How do I convert a Slice(UInt8) to a string?
soveran has joined #crystal-lang
zodiak has joined #crystal-lang
zodiak_ has quit [Ping timeout: 240 seconds]
matp has quit [Ping timeout: 252 seconds]
matp_ has joined #crystal-lang
matp_ has quit [Remote host closed the connection]
matp has joined #crystal-lang
<trapped> stupid question: does the master branch run on arm?
Ven has joined #crystal-lang
soveran has quit [Remote host closed the connection]
matp has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<jhass> trapped: nope
kipar has joined #crystal-lang
Raimondii has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
kipar has quit [Ping timeout: 250 seconds]
Raimondii is now known as Raimondi
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
matp has joined #crystal-lang
soveran has quit [Remote host closed the connection]
akwiatkowski has joined #crystal-lang
JohnRose has joined #crystal-lang
JohnRose has quit [Client Quit]
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
Philpax has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
soveran has quit [Remote host closed the connection]
<trapped> jhass: thanks
soveran has joined #crystal-lang
<leafybasil> I'm playing with an API that offers a 'streaming' endpoint, I wanted to add a method to the client lib that would let users specify a block to be executed on receipt of a message, but obviously this would block. I think I can use fibres to achieve the same thing without making the developer care about channels, but then I realised, maybe asking them to provide a channel is a better interface?
<jhass> I think that depends largely on the API
<jhass> what typical usages would look like
<jhass> it's basically a decision about control flow
<jhass> the block variant controls the callers control flow, so it can't do much else anymore
<jhass> the channel variant lets the caller control the flow of the library
<jhass> which might make the library harder to use in case the API needs regular pings or stuff like that
<leafybasil> Yup, which makes the channel very appealing, but the block potentially simpler for majority of users (not that there are any)
<leafybasil> With the block, would it not be possible to have the method spawn two fibres, one for consuming the API, and one for receiving messages from the consuming fibre that also takes the block and then applies it to any incoming message?
<leafybasil> I assume the method would return as normal, but the fibres would live in the background, communicating with each other
<jhass> possibly, it's hard to generalize all this and I can't make any recommendation without knowing the usage cases
<leafybasil> jhass: not 100% sure what you mean, the use cases would be whatever anyone wants to use it for, there's no clear right or wrong in my mind, would you be up for eyeballing some code if I push some later?
Raimondii has joined #crystal-lang
<jhass> ask me later again about that
<leafybasil> Haha
<leafybasil> Cool
<jhass> and I do think there are some inherent usage patterns imposed by the nature of the API and the data its provides
<leafybasil> I can imagine a use case where someone writes a bot, and wantst o react to messages, is happy to block and cares about little else
<leafybasil> And then I can imagine someone writing a graphic UI for the service, where they want to use the lib to send messages and take messages and display them
<jhass> and I can't imagine an IRC bot consuming an audio streaming API
<jhass> if you keep it abstract like that, sure
<jhass> but I think that's a little useful discussion
Raimondi has quit [Ping timeout: 240 seconds]
<leafybasil> jhass: to be more specific then, it's a client for gitter
<leafybasil> The data is either messages for a room, or events for a room
<jhass> the I would go with a channel based API
<jhass> For the GUI case it can just be polled in the GUI frameworks main loop
<jhass> for other cases the client can write their own small "polling" loop
<leafybasil> Sure, but that doesn't feel like it applies any less to the use of the block, and hiding any channel business inside of the lib
<leafybasil> I may just write both and ask for some feedback from any willing parties
<jhass> Let's stick with the GUI case, if you invoke the caller as a message arrives, it might be trying to draw it while the GUI framework is doing stuff like redrawing the window
<jhass> instead of being at a point where it's valid for the application to request stuff from the framework
<leafybasil> I would imagine incoming messages being placed somewhere the GUI loop can read from whenever it deems appropriate
<leafybasil> Be that some array, or a channel, or a queue
<leafybasil> But I may be missing something obvious in what you just said
<jhass> so just reimplementing a channel based API to workaround only being able to specify a callback
Raimondii is now known as Raimondi
<leafybasil> Yeah that's correct, the only difference is you could choose not to do that as a user
<leafybasil> The lib API would give you a somewhat convenient method to call, you could then handle things with channels when you decided you wanted to, but also choose not to
<leafybasil> I guess the only reason it even occurs to me is because I'm not used to langs with channels, and have spent a lot of time in ruby, so where it may be perfectly idiomatic and sensible to ask a user to provide a channel, the idea of being able to abstract that away seemed reasonable too
<leafybasil> (Please feel free to tell me I'm an idiot, I'm here to learn)
trapped has quit [Read error: Connection reset by peer]
ome has joined #crystal-lang
<jhass> meh I guess
<jhass> I'd just go with my primary usecase and see how it plays out
<leafybasil> Cool thanks for talking it through, I'll likely do that as it's less work, and then decide how I feel later
<txdv> can I extend a generic class with a specific type?
<FromGitter> <sdogruyol> hey guys, i am curious that do we have any fixture / factory_girl stuff like for spec?
pawnbox has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 244 seconds]
Kurisu has joined #crystal-lang
<Kurisu> Hi everyone, one thing makes me confused, why Crystal only provides union types? How about intersection types?
<jhass> I think that has been proposed, no final word yet
<jhass> though I don't quite remember the difference atm the more I think about it tbh
shadowshell has quit [Quit: Connection closed for inactivity]
<jhass> a union type already only responds to only the intersection of the methods provided by the types
<jhass> Kurisu: could you elaborate a usecase union types do not solve?
matp has quit [Remote host closed the connection]
<Kurisu> Benjamin Pierces's thesis gives a good overview: The most intriguing and potentially useful property of intersection types is their ability to express an essentially unbounded (though of course finite) amount of information about the components of a program.
<Kurisu> For example, the addition function (+) can be given the type Int -> Int -> Int ^ Real -> Real -> Real, capturing both the general fact that the sum of two real numbers is always a real and the more specialized fact that the sum of two integers is always an integer. A compiler for a language with intersection types might even provide two different object-code sequences for the two versions of (+), one using a floating point addition instruction and
<Kurisu> one using integer addition. For each instance of+ in a program, the compiler can decide whether both arguments are integers and generate the more efficient object code sequence in this case.
<Kurisu> This kind of finitary polymorphism or coherent overloading is so expressive, that ... the set of all valid typings for a program amounts to a complete characterization of the program’s behavior.
<jhass> sounds useful in functional languages, in object oriented languages like Crystal method overloading seems to solve that problem pretty well
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<Kurisu> https://github.com/crystal-lang/crystal/issues/2404 I find a issue mentioned it.
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
ome has quit [Quit: Connection closed for inactivity]
soveran has quit [Ping timeout: 240 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
aeosynth has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
<aeosynth> where is the documentation for @[]? eg @[Link], @[Flags]
<aeosynth> attributes
aeosynth has quit []
soveran has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Kurisu has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> does `HTTP::Client` respect my proxy settings?
<jhass> no
<FromGitter> <sdogruyol> ..thought so
<FromGitter> <sdogruyol> is there anything i can do about that?
<FromGitter> <sdogruyol> i mean i'm using a VPN and i can easily access the URL via `curl`
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> well https://github.com/greyblake/crystal-cossack works
<FromGitter> <sdogruyol> i am not sure why `http` doesn't
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Kurisu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
crystal-lang146 has joined #crystal-lang
<crystal-lang146> why when i use the http server i can connect from localhost but when i try to connect from my public ip i get connection refused (btw i'm not behind firewall).
<RX14> crystal-lang146, did you bind to 0.0.0.0?
<RX14> yeah
<RX14> you need HTTP::Server.new("0.0.0.0", PORT)
<RX14> or bind to whatever
<crystal-lang146> RX14: i user just HTTP::Server.new(PORT)
<crystal-lang146> RX14: *used
<RX14> well you need to add "0.0.0.0" to bind to all ips
<crystal-lang146> RX14: i tested it and it seems so. thank you!
<FromGitter> <jwoertink> Hey all, question about using the `compile` command. I see there's a `-o` option to name the output, but it doesn't seem to take a path of where the file needs to go. Is this possible?
<jhass> it doesn't?
<FromGitter> <jwoertink> at least not in this test I just ran :/
<FromGitter> <jwoertink> I did `crystal compile --release app/src/my_app.cr -o app/bin/runner`
<FromGitter> <jwoertink> it made a `my_app` executable in the `app/src` directory
<jhass> ah I think it has to come before the path
<FromGitter> <jwoertink> ?
<FromGitter> <jwoertink> like specify the -o before the --release?
<RX14> -o before the cr filename
<FromGitter> <jwoertink> oh
<RX14> maybe
<RX14> i think it should work after but whatever
<RX14> try it
soveran has quit [Remote host closed the connection]
<FromGitter> <jwoertink> hmm... I might not be doing this right. It's complaining about dependencies not being relative to the app now
<RX14> uhh
soveran has joined #crystal-lang
<FromGitter> <jwoertink> ```Running: crystal compile --release -o /Users/jeremywoertink/Sites/namechk/bin/runner /Users/jeremywoertink/Sites/namechk/app/registrator/src/registrator.cr ⏎ Error in ./app/registrator/src/registrator.cr:1: while requiring "kemal": can't find file 'kemal' relative to '/Users/jeremywoertink/Sites/namechk/app/registrator/src' ⏎ ⏎ require "kemal" ⏎ ^ ... [https://gitter
<FromGitter> ... .im/crystal-lang/crystal?at=578a91603c5129720e3f0f9d]
zenguyaz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<jhass> you have to run it next to your libs folder
<jhass> or set the CRYSTAL_PATH environment variable to the libs folder and the standard library
<FromGitter> <jwoertink> ah, ok
<FromGitter> <jwoertink> yeah, if I run it in that folder, it works
<FromGitter> <jwoertink> Setting the CRYSTAL_PATH env didn't work.
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=578a93b49f79ee4f2bc672f4]
<jhass> you have to include the standard library too
<jhass> see the output of crystal env
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=578a9456e4375c9212f38bd7]
<jhass> "see the", not "show me" ;)
<FromGitter> <jwoertink> lol
<jhass> and well without having overwritten CRYSTAL_PATH
<FromGitter> <jwoertink> ohhh... I see what you're saying
<FromGitter> <jwoertink> I didn't have to set the CRYSTAL_PATH because there already was one. I just needed to append my libs path to it
<jhass> well there's no real amending there, you have reset the whole thing
<FromGitter> <jwoertink> ok. I see that it has `libs`, but it's relative. So I just need to update that.
<jhass> yes
<FromGitter> <jwoertink> cool, thanks. I'll mess with that then
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
zenguyaz has quit [Ping timeout: 250 seconds]
mollusk_ has joined #crystal-lang
<mollusk_> test
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
soveran has joined #crystal-lang
<mollusk_> how do I get user input?
<FromGitter> <jwoertink> from the console?
<mollusk_> Ruby would do it like so: input = gets.chomp
<FromGitter> <jwoertink> you can use `gets`in crystal
<mollusk_> I figured as much however the docs don't seem to have it there
<FromGitter> <jwoertink> but, I don't think you can call ".chomp" directly on gets.
<FromGitter> <jwoertink> ```input = gets ⏎ case input.chomp ⏎ ....``` [https://gitter.im/crystal-lang/crystal?at=578aaa1b914c51592b2b636c]
<FromGitter> <jwoertink> so something like that
soveran has quit [Ping timeout: 276 seconds]
<mollusk_> I just learned about Crystal by the way. I have been looking for a compiled language with simple syntax.
<FromGitter> <jwoertink> Nice! Welcome :) I'm enjoying it so far
<mollusk_> Seems like Crystal is what I want but I am aware it has a long road ahead. The sponsers listed make me feel pretty confident the crystal will stay around while.
<mollusk_> man, I can't even build the first dependency for crystal
<mollusk_> Too bad I don't use Arch Linux, otherwise I would have it in the repos.
<FromGitter> <jwoertink> what system are you running on?
<mollusk_> Void Linux
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#a1a80d0 (master - Fixed #2994: Compiler crash when using Nil in lib binding): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/145274665
Oliphaunte has quit [Remote host closed the connection]
cristianoliveira has joined #crystal-lang
<cristianoliveira> Hello there
<RX14> hi
<cristianoliveira> Guys... I am trying to create a kind of Factory class with Crystal but I am getting some strange behavior from compiler
<cristianoliveira> the compiler says: Error in ./src/bojack/commands/set.cr:5: undefined constant Command (did you mean 'Commands'?)
<cristianoliveira> class Set < Command
<cristianoliveira> I have no clue how to fix it :/
<RX14> well it seems like a bug
<RX14> but the simple fix would be to add context to the class name
<RX14> i.e. Commands::Command instead of Command
<RX14> qualify it a bit more to see if it finds it
<cristianoliveira> I've tried it :(
<cristianoliveira> I did Bojack::Commands::Command
<RX14> try ::Bojack::Commands::Command
<cristianoliveira> Let me try
<RX14> what crystal version is this?
<cristianoliveira> Crystal 0.18.6 (2016-06-29)
<cristianoliveira> OSX
<RX14> hmm
<cristianoliveira> Same problem with ::Bojack::Commands::Command
<RX14> well seems like a bug to me somehow
<cristianoliveira> Do you think it may be a bug?
<RX14> it may be but i can't see why it wouldnt be found before
<RX14> oh
<RX14> i know why
<RX14> you require set.cr from command.cr
<RX14> but command.cr requires set.cr
<cristianoliveira> hmmm
<RX14> you should create a commands.cr in src/bojack which requires them in the right order
<RX14> then require that
<cristianoliveira> I see
<cristianoliveira> Let me try
Oliphaunte has joined #crystal-lang
<cristianoliveira> Greeat!! :D
<cristianoliveira> Thanks a lot RX14 ^^
<RX14> np
<cristianoliveira> I was dealing with for while
<RX14> its not actually due to the fact that it was a recursive definition itself
<RX14> recursive require
<RX14> its because once a file is required once it is never required again, and crystal classes need to be required in order
<cristianoliveira> hmmm i got it
<RX14> it requires commands.cr, which requires set.cr which then ignores the require "./command" then command class isn't until further down the file
<RX14> after the require "./set"
<RX14> if you added the requires after defining the command class it would work
<RX14> but i think this way is cleaner
<RX14> you can just `require "./commands/command"` then `require "./commands*"`
<RX14> ./commands/*
<RX14> but yeah
<RX14> i'm off
<cristianoliveira> heheh ok
<cristianoliveira> thks again
jnylen has joined #crystal-lang
matp has joined #crystal-lang
<mollusk_> installing Arch so that I can get crystal with less hassle
<mollusk_> if someone wants to creat a Void Linux package, there's a neat build system you can play with
mollusk_ has quit [Quit: Leaving]