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.
<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
<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?