waj_ has quit [Read error: Connection reset by peer]
waj__ has joined #crystal-lang
waj__ has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
ylluminate has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
elbow_jason has quit [Quit: Leaving]
kulelu88 has quit [Quit: Leaving]
bcardiff has quit [Quit: bcardiff]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
NeverDie has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
vonkingsley has joined #crystal-lang
bcardiff has joined #crystal-lang
vonkingsley has quit [Quit: Page closed]
BlaXpirit has joined #crystal-lang
havenwood has joined #crystal-lang
sdogruyo_ has quit [Ping timeout: 265 seconds]
sdogruyol has joined #crystal-lang
<BlaXpirit>
How do macros defined inside a class work?
<BlaXpirit>
I thought they could be used like methods, but they just can't be accessed
<BlaXpirit>
very sad to me that macros are accessible only inside the calss
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
havenwood has quit [Ping timeout: 256 seconds]
<crystal-gh>
[crystal] BlaXpirit opened pull request #1286: Make anchors in docs conformant to HTML5 (master...anchors-html5) http://git.io/vsbYI
<crystal-gh>
[crystal] BlaXpirit opened pull request #1287: Make anchors in docs conformant to HTML4 (master...anchors-html4) http://git.io/vsbYs
bcardiff has quit [Quit: bcardiff]
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Client Quit]
<dzv>
writing a struct to a socket works, but reading it back in doesn't seem to work. http://carc.in/#/r/cui
Ven has joined #crystal-lang
<BlaXpirit>
dzv, something about the way you're reading seems wrong to me
<dzv>
something about the slice seems wrong to me
<dzv>
the read works. if i print the slice i have the data
sdogruyol has quit [Read error: Connection reset by peer]
<BlaXpirit>
dzv, `slice2 = s2.read(size)` this is not good
<dzv>
oh
<dzv>
shit
<dzv>
working now, thanks
<BlaXpirit>
just needed s2.read(slice2, size) right
<dzv>
right
sdogruyol has joined #crystal-lang
<dzv>
is there a way to trace memory allocations?
<jhass>
dzv: I can imagine valgrind has a flag for it
<jokke>
hi
<jokke>
what's good practice concerning typing function arguments
<jokke>
i'm still a bit unsure when the compiler notices that i'm doing something i shouldn't and when it's a runtime error
<jokke>
ideally i would have the compiler find any type errors
<jokke>
does it mean i need to define types for all funktion arguments?
<jokke>
*method
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
sdogruyol has quit [Read error: Connection reset by peer]
<jhass>
jokke: type related runtime errors are only calling .not_nil! (getter! and property! do that too) and resolving a union by casting ([1, "1"].sample as String)
<jhass>
jokke: so just use .try instead and .is_a?, case foo; when Type; when OtherType to handle all cases
<jhass>
adding method restrictions everywhere can improve the error messages though, since the traces get smaller
<jokke>
ah i see
<jokke>
i'd love to see something like rubocop for crystal <3
sdogruyol has joined #crystal-lang
<jhass>
I think we still need to develop the idioms/best practices it could enforce though ;)
<jokke>
yeah :)
leafybasil has quit [Ping timeout: 240 seconds]
<jokke>
but i'm totally hooked to crystal now!
<jhass>
great!
<jhass>
guess it's like crystal meth after all :P
<jokke>
hehe
leafybasil has joined #crystal-lang
ssvb has joined #crystal-lang
wanderer_ has joined #crystal-lang
kyrylo has joined #crystal-lang
<wanderer_>
jhass: hey, what's up? :) do you know where `Int` and `Char` come from in `lib LibC; fun mkstemp(result : Char*) : Int; end`?
<jhass>
RX14: sure, would love a plugin for that ;)
<BlaXpirit>
yep, that's great, RX14
<BlaXpirit>
now it's actually class Process like i expected
<crystal-gh>
[crystal] jhass opened pull request #1288: spawn: print exception class and backtrace to stderr (master...spawn_exception) http://git.io/vsN1L
<dzv>
1/msg jokke hey
<jhass>
dzv: btw it's good IRC etiquette to ask people in channel prior messaging them ;)
<RX14>
Kilo`byte, still working on that ircd?
waj has joined #crystal-lang
Ven has joined #crystal-lang
kyrylo has joined #crystal-lang
wanderer_ has quit [Ping timeout: 246 seconds]
waj has quit [Remote host closed the connection]
<vifino>
Is there something like HTTMultiParty for crystal?
<RX14>
i thin I saw something to do with multipaert in the api
<RX14>
hmmn i don't think there is sorry
ssvb has joined #crystal-lang
<vifino>
RX14: That's fine, I'm just porting ruby code :P
NeverDie has joined #crystal-lang
daphee has joined #crystal-lang
<daphee>
Hi, is there a way for readline to operate in raw mode and not print carriage returns?
<vifino>
asterite: Mind if I steal some code from manastech/crystal_slack? I could definitly need it :)
<RX14>
that repo has no licence :(
<RX14>
and defaults are all rights reserved on github
<RX14>
so always remember to add a license
<vifino>
RX14: That's why I'm asking, at least I can throw a "Asterite allowed me to! Don
<vifino>
.-.
<RX14>
yeah
<vifino>
't sue me pls! D:" before.
<RX14>
would be nice if it had a license though
<vifino>
yeah..
havenwood has joined #crystal-lang
sdogruyol has quit [Ping timeout: 250 seconds]
sdogruyol has joined #crystal-lang
<asterite>
vifino: now it has a license :)
bcardiff has joined #crystal-lang
dylanmei has quit [Quit: ZZZzzz…]
DeBot has quit [Ping timeout: 250 seconds]
<crystal-gh>
[crystal] daphee opened pull request #1290: Readline.bind_key and Readline.done added (master...readline_bind_key_readline_done) http://git.io/vsxew
Ven has joined #crystal-lang
<daphee>
jhass: Concerning your comments on my PR. To correct the definition of the bind_key function I would change Int to LibReadline::Int right? How would the Proc in the argument return such a LibReadline::Int then? Could one do e.g. "0 as LibReadline::Int" or "0 as LibC::Int" ?
<jhass>
daphee: both LibReadline::Int.cast(0) and LibC::Int.cast(0) would work (or .zero for this special case), though we tend to hide the Lib* stuff in the higher level abstraction, so I'd restrict to Int32 (or nothing at all) and convert in the binding
<daphee>
jhass: Ok, so bind_key receives a Proc(Int32, Int32, Int32) and converts it to a Proc(LibReadline::Int,LibReadline::Int,LibReadline::Int) before calling LibReadline.rl_bind_key, right? Do I need to wrap the original Proc with another Proc where I do the .cast?
<jhass>
mmh
<jhass>
yeah, I guess wrapping would be okay here, LLVM should optimize the extra function call out
<daphee>
I guess because the original function "f" is wrapped in "wrapper"'s closure right?
<jhass>
yes
<jhass>
you need to pass f as parameter
shama has joined #crystal-lang
<daphee>
I think I don't understand how this would work. I can't wrapper in bind_key right?
<daphee>
*can't call
<jhass>
eh yeah, I guess I had a brainfart there, sorry
<jhass>
mmh, but that you can't pass a closure is annoying anyway
<jhass>
there's no `data`/`user_data` parameter?
<daphee>
no, there isn't unfortunately. It would be the easiest to change bind_key to receive a Proc(LibReadline::Int...). Wouldn't be too bad neither I believe?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dylanmei has joined #crystal-lang
<jhass>
I guess
<jhass>
but not being able to pass a closure... idk how you'd do anything useful with such an API
<jhass>
you'd have to store all needed data in a global :(
<daphee>
yeah. do you know if it would be possible technically to support closures in C bindings?
<jhass>
closures work by passing their context as an additional parameter
<waj>
but it requires executing code from stack or heap which is not enabled by default
<jhass>
ah yeah, that sounds like a bad idea :/
<waj>
yup, it opens a whole new world of security holes :)
<jhass>
daphee: well, given that makes that API not particularly useful, exposing LibReadline::Int to the user doesn't make much of a difference anyhow I guess
waj has quit [Remote host closed the connection]
Ven has joined #crystal-lang
elbow_jason has joined #crystal-lang
Ven has quit [Remote host closed the connection]
Ven has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
<jokke>
how do i use the Projectfile?
<jokke>
if i init a lib i get a Projectfile
<jokke>
i want to write an app which depends on a lib
<asterite>
Cool! I don't much (actually, antyhing) about arch. What does the above mean?
<RX14>
asterite, AUR is cuer-contributed packages you build yourself
<RX14>
community is distro packages you have access to on day 1
<RX14>
user-contributed*
<asterite>
So it's like now it's in the "official" repository?
<RX14>
basically yes
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: http://git.io/vsxFr
<crystal-gh>
crystal/master d3b2402 Ary Borenszweig: Some docs for BufferedIOMixin
<crystal-gh>
crystal/master 52b06ff Ary Borenszweig: Added a spec for the commit 2d44fe: if a subclass decides to raise or exit in a method, return type checking should still succeed
<asterite>
Really nice! You rock :-)
kori has quit [Ping timeout: 244 seconds]
<travis-ci>
manastech/crystal#52b06ff (master - Added a spec for the commit 2d44fe: if a subclass decides to raise or exit in a method, return type checking should still succeed): The build passed. https://travis-ci.org/manastech/crystal/builds/77369017
Ven has quit [Ping timeout: 255 seconds]
shadeslayer has quit [Ping timeout: 260 seconds]
shadeslayer has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vspUP
<crystal-gh>
crystal/master d94e72f Ary Borenszweig: Fixed #640: make `crystal run` return the error code from the underlying program. Also check for segmentation fault.
DeBot has joined #crystal-lang
Excureo has quit [Read error: Connection reset by peer]
Excureo has joined #crystal-lang
blue_deref has joined #crystal-lang
Excureo has quit [Remote host closed the connection]
<travis-ci>
manastech/crystal#d94e72f (master - Fixed #640: make `crystal run` return the error code from the underlying program. Also check for segmentation fault.): The build passed. https://travis-ci.org/manastech/crystal/builds/77373218
trapped has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vspqA
<crystal-gh>
crystal/master acf4829 Ary Borenszweig: Rewrote system and backtick with Process.run(shell: true), and use `system` instead of `Process.run` in compiler's command
sooli has joined #crystal-lang
<asterite>
dzv: doing `STDIN.read_timeout = 3` feels like magic :-)
<asterite>
it's so nice to see that working
<asterite>
Can you do something like that in Ruby?
Codefriar has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
waj has joined #crystal-lang
<dzv>
asterite: to timeout io you would use eventmachine or similar. another option is select with read_nonblock which returns immediately. so no, you can't do that unless someone wrote an abstraction on top of one of those
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: http://git.io/vspFy
<crystal-gh>
crystal/master df716ad Ary Borenszweig: `crystal run` doesn't need to execute the program in a shell. Also make `Process.run` without a block set the `$?` variable
<crystal-gh>
crystal/master 83311f3 Ary Borenszweig: Disallow using non-instantiated generic types as type arguments. Fixes #1206, fixes #578, fixes #552, fixes #258
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vspNe
<crystal-gh>
crystal/master 67f13ed Ary Borenszweig: Fixed #1256: in docs, regex doesn't need it's value to be escpaed
<travis-ci>
manastech/crystal#83311f3 (master - Disallow using non-instantiated generic types as type arguments. Fixes #1206, fixes #578, fixes #552, fixes #258): The build passed. https://travis-ci.org/manastech/crystal/builds/77391233
<Netfeed>
asterite: alright
bcardiff has quit [Quit: bcardiff]
leafybasil has joined #crystal-lang
n0xff has joined #crystal-lang
waj_ has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
bcardiff has joined #crystal-lang
havenwood has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
waj has quit [Remote host closed the connection]
BlaXpirit has quit [Quit: Konversation]
<sardaukar>
I have a JSON file that I created with a class (using json_mapping)
<sardaukar>
but I can't do class.from_json (file_content)
<sardaukar>
one of the fields in the file is a Array(UInt8)
<sardaukar>
in /usr/local/Cellar/crystal-lang/0.7.6/src/json/from_json.cr:65: undefined method 'new' for UInt8:Class
<sardaukar>
it saves properly
<sardaukar>
but I can't load it
blue_deref has quit [Quit: bbn]
<sardaukar>
I see the spec doesn't have it
<sardaukar>
I'll just convert them to ints to save