jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.6 | Fund Crystals development: http://is.gd/X7PRtI | 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
waj has quit [Remote host closed the connection]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
tatey_ has joined #crystal-lang
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dylanmei has quit [Quit: ZZZzzz…]
leafybas_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
elbow_jason has quit [Quit: Leaving]
ylluminate has quit [Ping timeout: 256 seconds]
kyrylo has quit [Ping timeout: 255 seconds]
<crystal-gh> [crystal] technorama opened pull request #1292: IO.close cleanup. (master...f/io_close) http://git.io/vsjlP
ylluminate has joined #crystal-lang
elbow_jason has joined #crystal-lang
no0p has quit [Ping timeout: 246 seconds]
no0p has joined #crystal-lang
fowlduck has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
fowlduck has quit [Remote host closed the connection]
elbow_jason has quit [Ping timeout: 260 seconds]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
kulelu88 has quit [Quit: Leaving]
fowlduck has joined #crystal-lang
fowlduck_ has joined #crystal-lang
fowlduck has quit [Read error: Connection reset by peer]
ssvb has quit [Ping timeout: 250 seconds]
fowlduck_ is now known as fowlduck
<fowlduck> huh, the homebrew for crystal is out of date
<fowlduck> oh, need to tap
<fowlduck> soooo happy that crystal is going M-N threading
<vegai> it is? Cool, I guess.
<vegai> never gotten into that debate too much
<fowlduck> at least M-M
<fowlduck> going single-threaded would be such a waste
<fowlduck> the salt bounty says they're going multithreaded https://salt.bountysource.com/teams/crystal-lang
<fowlduck> really hoping they don't straight copy ruby's URI
<fowlduck> looks like they're targeting a more modern rfc, so that's good
<fowlduck> well, the most modern, for uri, I think
<fowlduck> ruby's uri is busted as hell
<vegai> wasn't it Rust who went M-M?
<fowlduck> wouldn't surprise me
<vegai> ah, yes Daniel
<vegai> I guess they went eventually to support both models through the library
<vegai> although that thread is 2 years old already, lots of things happened after
<fowlduck> ah, interesting points there that I wasn't aware of
<fowlduck> some solid reasons to go M:M
<vegai> yeah
<fowlduck> aaaand now I'm watching https://www.youtube.com/watch?v=KXuZi9aeGTw
<fowlduck> iiiinteresting
tatey_ has quit []
<dzv> is there a way to run a private method for debugging?
<jhass> class Foo; def foo; private_method; end; end;
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyo_ has joined #crystal-lang
BlaXpirit has joined #crystal-lang
<dzv> is there a way to use an instance variable (or any variable) inside of a function passed to a c function? closures don't work
<jhass> if you can pass a "user_data" or somesuch param along, there's a workaround
<jhass> if not, not without a global
<dzv> this function doesn't have one
<jhass> then you would've have register a function that uses for example a global hash to lookup the right handler to call
<jhass> or a singleton could work too I guess
tatey_ has joined #crystal-lang
leafybas_ has quit [Remote host closed the connection]
sdogruyo_ has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
kyrylo has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #1293: Allow to run programs through a shell receiving huge argument lists (master...shell_args) http://git.io/vGe1U
leafybasil has joined #crystal-lang
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
<Netfeed> jhass: shouldn't shell be an argument aswell, that maybe defaults to /bin/sh ?
<jhass> Netfeed: maybe, but I want to keep the conflict potential minimal for this PR
Ven has joined #crystal-lang
<BlaXpirit> dzv, are u still here?
<dzv> yes
<BlaXpirit> oh, your function really doesn't have a user_data :(
<dzv> the library doesn't
<BlaXpirit> jhass helped me with this a long time ago. so helpful, this "box"
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
kyrylo has quit [Quit: Konversation terminated!]
kyrylo has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
sdogruyol has quit [Remote host closed the connection]
ssvb has joined #crystal-lang
<dzv> does anyone have a program that forks?
<dzv> or does signal handling?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] technorama opened pull request #1295: Waitpid enhancements: (master...f/nowait_pid) http://git.io/vGvcX
<RX14> you could totally include a singleton macro in the standard library
Ven has joined #crystal-lang
Ven has quit [Client Quit]
sdogruyol has joined #crystal-lang
Ven has joined #crystal-lang
<tatey_> What's the difference between 0 and 1 in this gist? The latter gives a compile error. https://gist.github.com/tatey/6f7d79d7d229a74adff7
<jhass> could be seen as parser bug I guess
<jhass> as Constant, Constant is parsed as an expression
<tatey_> Ah, okay. Should I raise an issue?
<jhass> I bet LibC.recvfrom(fd, (slice.to_unsafe as Void*), LibC::SizeT.cast(count), 0, nil, nil) would work
<jhass> not sure, maybe
<jhass> depends on how you feel about it/whether you want to argue for a case :P
<tatey_> Yeah, it does
<tatey_> As in, yes, wrapping in parans works
<tatey_> Thanks :-)
ssvb has quit [Ping timeout: 255 seconds]
sdogruyol has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
shadeslayer has quit [Ping timeout: 250 seconds]
shadeslayer has joined #crystal-lang
shadeslayer has quit [Ping timeout: 260 seconds]
shadeslayer has joined #crystal-lang
<tatey_> Looking for feedback on implementing recvfrom in IPSocket: https://github.com/manastech/crystal/pull/332#issuecomment-135405157
tatey_ has quit []
sdogruyol has joined #crystal-lang
sdogruyol has quit [Remote host closed the connection]
sdogruyo_ has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
sdogruyo_ has quit [Remote host closed the connection]
dylanmei has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vGfX4
<crystal-gh> crystal/master ef58475 Ary Borenszweig: Use `Process.run` instead of `system` for linker command. Related to #300
<asterite> jhass: regarding http://stackoverflow.com/questions/32237551/crystal-lang-c-binding-struct-doesnt-seem-to-pass-null-value , maybe we can make `out foo` be an error if `foo` is already declared, right?
<jhass> that might be good, but I'd still like it to zero the memory tbh
<jhass> or maybe have unsafe_out if you need the performance of not doing it
<jhass> or yet better have a flag on the fun definition on whether to do it or not, with the default of doing it
fowlduck has joined #crystal-lang
fowlduck has quit [Ping timeout: 250 seconds]
NeverDie has joined #crystal-lang
dylanmei has quit [Quit: ZZZzzz…]
<BlaXpirit> I'm wondering what's the best way to tell crystal doc to generate documentation for only one module
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
ssvb has joined #crystal-lang
havenwood has joined #crystal-lang
sdogruyol has joined #crystal-lang
blue_deref has joined #crystal-lang
<dzv> is there an Module.included type of method?
<jhass> there's a macro included hook
<dzv> i don't see it
waj has joined #crystal-lang
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
luislavena has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blassin has joined #crystal-lang
<blassin> hello
<blassin> I have a weird issue with my code
<blassin> I have a hash with lambdas as keys, and I can't access its keys somehow
<BlaXpirit> blassin, "lambdas"?
<blassin> if I try printing hash.keys, I get a no overload matches error
<BlaXpirit> please elaborae and show an example
<blassin> INSTRUCTION_DICTIONARY = { "sub" => ->(e: ExC) { Arithmetic.sub e } }
<blassin> if I try to print INSTRUCTION_DICTIONARY.keys, I get the error
<blassin> but without the print, the code works!
<blassin> this is used with INSTRUCTION_DICTIONARY[instruction.name].call exc
<blassin> I don't know why I can't print the keys of the hash!
<BlaXpirit> blassin, i cannot reproduce
<blassin> would you like a look at the code?
<BlaXpirit> yes
<blassin> I'll DM it
* blassin slaps BlaXpirit around a bit with a large fishbot
<blassin> oops
<jhass> it's a secret?
Ven has joined #crystal-lang
ssvb has quit [Ping timeout: 244 seconds]
<blassin> jhass: no, just a lot of code :D
<blassin> jhass: do you want to have a look too?
<jhass> if it's on github/gist
<blassin> it's not
<blassin> I use MadEye.io
<BlaXpirit> i have no idea what's going on there
sdogruyol has quit [Remote host closed the connection]
ssvb has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vGUTM
<crystal-gh> crystal/master 70caaca Ary Borenszweig: Removed duplicate properties from FileDescriptorIO
<crystal-gh> crystal/master 09989c5 Ary Borenszweig: Fixed #1294: Inconsistent variance in generics
<travis-ci> manastech/crystal#09989c5 (master - Fixed #1294: Inconsistent variance in generics): The build passed. https://travis-ci.org/manastech/crystal/builds/77520539
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
blue_deref has quit [Quit: bbn]
<blassin> shouldn't #clone return a copy of an object?
<blassin> or is it still by reference?
havenwood has joined #crystal-lang
<jhass> a shallow copy I think
<blassin> Object.clone says "Returns a deep copy of this object."
<blassin> shallow is #dup
<blassin> I tried cloning an object, but the clone seems to act by reference
<jhass> "Object returns self, but subclasses override this method to provide specific clone behaviour."
<blassin> and if my subclasses have not?
<jhass> they get Object's obviously
<blassin> I don't get it, the carc.in I posted confuses me
<jhass> I guess Array doesn't override it either yet
<jhass> mmh, it does
<jhass> ah, but you clone your own
<jhass> so, the above applies
<blassin> but I didn't specify a clone behavior
<blassin> right?
<jhass> you have your custom class, you don't implement clone so you get Object's, which returns self
<blassin> ah I see
emancu has joined #crystal-lang
emancu has quit [Client Quit]
sdogruyol has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
luislavena has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vGUNO
<crystal-gh> crystal/master d986486 Ary Borenszweig: Disallow using `out x` if `x` is already defined
<crystal-gh> crystal/master c7d4f74 Ary Borenszweig: Allow `out _`
luislavena has joined #crystal-lang
dylanmei has joined #crystal-lang
<travis-ci> manastech/crystal#c7d4f74 (master - Allow `out _`): The build passed. https://travis-ci.org/manastech/crystal/builds/77538248
<BlaXpirit> if i have [0, 1, 2, 3, 4], how can i iterate over {0, 1}, {1, 2}, {2, 3}, {3, 4} ?
<jhass> .each_cons(2)
<jhass> at least in ruby, let's see
<BlaXpirit> yeah, googling "ruby pairwise python" told me this
<jhass> >> (0..4).each_cons(2)
<DeBot> jhass: # => Iterator(T)::Cons(Range(B, E)::ItemIterator(Int32, Int32), Int32)(@iterator=#<Range(B, E)::ItemIterator(Int32, Int32):0x8cedfc0 @range=0..4, @current=0, @reached_end=false>, @n=2, @values=[]) - http://carc.in/#/r/cyt
<jhass> >> (0..4).each_cons(2).to-a
<DeBot> jhass: Error in line 4: undefined method 'to' for Iterator(T)::Cons(Range(B, E)::ItemIterator(Int32, Int32), Int32) - http://carc.in/#/r/cyu
<jhass> >> (0..4).each_cons(2).to_a
<DeBot> jhass: # => [[0, 1], [1, 2], [2, 3], [3, 4]] - http://carc.in/#/r/cyv
<BlaXpirit> :o that's nice, thanks
<jhass> well, it's arrays since it's parametric, but yeah
<crystal-gh> [crystal] kirbyfan64 opened pull request #1298: Refactor some code related to handling type specifics error (master...refactor-gen) http://git.io/vGTvh
luislavena has quit [Remote host closed the connection]
qard has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dylanmei has quit [Ping timeout: 256 seconds]
<crystal-gh> [crystal] kostya opened pull request #1299: add string#blank? (master...blank) http://git.io/vGTkj
blassin has quit [Quit: Page closed]
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vGTLy
<crystal-gh> crystal/master bf284d9 Ryan Gonzalez: Refactor some code related to handling type specifics error
<crystal-gh> crystal/master 67ee5ad Ryan Gonzalez: Fix a comment typo
<crystal-gh> crystal/master 63be5f9 Ary Borenszweig: Merge pull request #1298 from kirbyfan64/refactor-gen...
dylanmei has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<travis-ci> manastech/crystal#63be5f9 (master - Merge pull request #1298 from kirbyfan64/refactor-gen): The build has errored. https://travis-ci.org/manastech/crystal/builds/77544497
leafybasil has quit [Ping timeout: 250 seconds]
fowlduck has joined #crystal-lang
luislavena has joined #crystal-lang
shama has joined #crystal-lang
waj has joined #crystal-lang
luislavena has quit [Remote host closed the connection]
elbow_jason has joined #crystal-lang
dyulax has joined #crystal-lang
<dyulax> any plans for creating a gitter room? https://gitter.im/rails/rails
luislavena has joined #crystal-lang
<BlaXpirit> dyulax, there was someone who make a room in "slack" and many suggested "gitter"
<dyulax> i don't know if i still didn't find the right irc client
<dyulax> or if they all are awfull
<BlaXpirit> i dont know
<dyulax> and bitter looks so cool... :)
<BlaXpirit> i'm just using the default IRC client of KDE and i know it's the best
<dyulax> *gitter
<jhass> I was happy with pidgin long enough but invested the time to properly setup weechat
<jhass> which allowed my idling to go from < 10 channels to uh, dunno, > 30
dyulax_ has joined #crystal-lang
dyulax has quit [Quit: Saindo]
dyulax_ is now known as dyulax
dyulax has quit [Remote host closed the connection]
dyulax has joined #crystal-lang
leafybasil has joined #crystal-lang
luislavena has quit [Ping timeout: 244 seconds]
luislavena has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
fowlduck has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vGkJ0
<crystal-gh> crystal/master d32e6c7 Ary Borenszweig: Removed `BufferedIO` and renamed `BufferedIOMixin` to `BufferedIO`
<crystal-gh> crystal/master cd74148 Ary Borenszweig: Removed `Nil#to_i`: if we are trying to spot nils at compile time, this method goes against that.
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vGkYY
<crystal-gh> crystal/master bec13b1 Felix Scheinost: Readline.bind_key and Readline.done added
<crystal-gh> crystal/master 8bb0413 Felix Scheinost: Readline.done takes/receives a Bool now; Proc in bind_key correctly uses LibC::Int instead of Int now
<crystal-gh> crystal/master 38e66f8 Felix Scheinost: Changed Readline.bind_key handling to use a global dict; Added unbind_key
<travis-ci> manastech/crystal#cd74148 (master - Removed `Nil#to_i`: if we are trying to spot nils at compile time, this method goes against that.): The build passed. https://travis-ci.org/manastech/crystal/builds/77563651
Ven has joined #crystal-lang
emancu has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vGk0a
<crystal-gh> crystal/master 92b0893 Ary Borenszweig: Fixed: `responds_to?` didn't work well with virtual types
<travis-ci> manastech/crystal#92b0893 (master - Fixed: `responds_to?` didn't work well with virtual types): The build passed. https://travis-ci.org/manastech/crystal/builds/77571440
<jhass> asterite: https://github.com/manastech/crystal/commit/83311f38fc6ca6873fe144496cd3684d8c06742c broke the plugin architecture of my bot :(
<jhass> mmh, maybe
emancu has quit []
<jhass> >> class Foo(T); end; module Bar; end; class A; include Bar; end; h = Hash.new(Symbol, Foo(Bar)).new; h[:a] = Foo(A).new
<DeBot> jhass: in /usr/lib/crystal/hash.cr:39: undefined constant K - http://carc.in/#/r/cz0
<jhass> wat
<jhass> oh
<jhass> >> class Foo(T); end; module Bar; end; class A; include Bar; end; h = Hash(Symbol, Foo(Bar)).new; h[:a] = Foo(A).new
<DeBot> jhass: # => #<Foo(A):0x8f4bff0> - http://carc.in/#/r/cz1
<BlaXpirit> :D
<jhass> >> class Foo(T); end; module Bar; end; class A; include Bar; end; h = Hash(Symbol, Foo(Bar)).new; h[:a] = Foo(Bar).new
<DeBot> jhass: # => #<Foo(Bar):0x9085ff0> - http://carc.in/#/r/cz2
<jhass> mmh
<jhass> oh
<jhass> ah great, back to Bug: trying to downcast HTTP::ChunkedContent <- HTTP::FixedLengthContent
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
luislavena has quit [Remote host closed the connection]
n0xff has quit [Ping timeout: 272 seconds]
luislavena has joined #crystal-lang
<asterite> jhass: but that functionality wasn't working well, and I think it doesn't make much sense (to have, say, an array of every possible Range)
<asterite> how can I reproduce HTTP::ChunkedContent <- HTTP::FixedLengthContent?
<jhass> run DeBot's main.cr with Crystal HEAD
<jhass> doesn't seem to happen with 0.7.6
<jhass> let me push the alias_method "fix" :(
<jhass> trying to reduce it atm
<jhass> asterite: oh and Hash(String, PluginContainer(Plugin)).new seems to work for now
<jhass> er Framework::Plugin to get the right one in that context
<BlaXpirit> >> class A; end; abstract class B < A; abstract def f(x: Int32): Int32; end; class C < B; end; C.new
<DeBot> BlaXpirit: # => #<C:0x9ab8ff0> - http://carc.in/#/r/cz3
<BlaXpirit> ??
fowlduck has quit [Remote host closed the connection]
waj has quit [Remote host closed the connection]
<jhass> asterite: require "http/client"; HTTP::Client.get("") seems to reproduce on head
<dzv> would transparent futures be considered as a language feature? val = future { foo }. using val would transparently get the return of foo and satisify all type requirements when val is passed to other methods.
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> oO
<jhass> "docs, eh"
<jhass> did you bisect?
dylanmei has quit [Quit: ZZZzzz…]
<asterite> Manually
<jhass> let me bisect, I have a hunch it's older
<asterite> No, it happens if I put a return type to IO#read
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<asterite> Hm, well, it's hard, because it's that combined with something else
<asterite> now I'll need to reduce it, of course
dyulax has quit [Quit: Saindo]
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vGkA8
<crystal-gh> crystal/master 084ec07 Ary Borenszweig: Fixed JSON parsing regarding whitespace. Related to #1299
<crystal-gh> crystal/master 119f8ab Ary Borenszweig: BitArray can be a struct
<crystal-gh> crystal/master efd9bb2 Ary Borenszweig: Some more docs
<asterite> jhass: I just fixed it... mmm... when I found the bug it didn't feel good :(
<jhass> oO
<asterite> The problem was that I was accidentally overwriting the `self_type` variable
<jhass> sounds like too big methods
<asterite> Yes, that's why I extracted that part to a sub-method
<asterite> The method is still big, though. It was small in the beginning but grew over time
<jhass> my limit is about half a screen, of whatever screen I happen to use :P
<jhass> but what helped me really a lot more than counting lines is the "same level of abstraction" rule
<jhass> that is trying to keep the "level of knowledge" inside a method the same
<jhass> it's vague I know, it's about things like logic for constructing a thing vs logic deciding which elements to include it
<jhass> I also like to extract predicates
<jhass> if foo.bar == baz -> if is_it_a_baz?(foo)
<jhass> and in doubt your methods really can't be small enough
<travis-ci> manastech/crystal#8c28ea8 (master - Fixed bug in return type checking): The build has errored. https://travis-ci.org/manastech/crystal/builds/77586887
DeBot has quit [Ping timeout: 250 seconds]
DeBot has joined #crystal-lang
luislavena has quit []
<crystal-gh> [crystal] technorama opened pull request #1300: New method: Exception#inspect_with_backtrace (master...f/exception_print) http://git.io/vGIJW
tatey_ has joined #crystal-lang
<BlaXpirit> how can I turn a slice back to a pointer+size?
<jhass> .pointer and .size?
<crystal-gh> [crystal] luislavena opened pull request #1301: Travis: define inclusion rules instead of exclusion (master...explicit-travis-ci) http://git.io/vGIqJ
fowlduck has joined #crystal-lang
<BlaXpirit> jhass, there is no .size, and length returns item count
<BlaXpirit> i thought of something
<BlaXpirit> (slice.pointer as Pointer(UInt8) - (slice.pointer+slice.length) as Pointer(UInt8))
luislavena has joined #crystal-lang
<jhass> well, you construct a slice with the item count, not the bytesize
<BlaXpirit> >> slice = Slice(Int32).new(5, 123); {slice.to_unsafe as Pointer(Void), ((slice.to_unsafe+slice.length) as Pointer(UInt8) - slice.to_unsafe as Pointer(UInt8))}
<DeBot> BlaXpirit: # => {Pointer(Void)@0x8acbf90, 20} - http://carc.in/#/r/d0v
<jhass> but wouldn't just .length * sizeof(.value) give the bytesize?
<BlaXpirit> this is what i want. i should've said that i actually want Pointer(Void) and byte size
<BlaXpirit> jhass, perhaps it would
<jhass> er, sizeof(typeof(.value)
fowlduck has quit [Ping timeout: 240 seconds]
<BlaXpirit> slice.pointer is kinda strange btw. it requires an argument and only does errorchecking with it
<BlaXpirit> i mean, i get the point, but it's strange
<BlaXpirit> >> slice = Slice(Int32).new(5, 123); {slice.to_unsafe as Pointer(Void), slice.length * sizeof(typeof(slice[0]))}
<DeBot> BlaXpirit: # => {Pointer(Void)@0x9e10f90, 20} - http://carc.in/#/r/d0y
<BlaXpirit> that's nice, thanks.
luislavena has quit []
<BlaXpirit> hmm, the IO hierarchy is so strange
<BlaXpirit> also I really wish StringIO and File had a similar API
<BlaXpirit> StringIO should have `seek`, `tell`
<BlaXpirit> are there any arguments against it?
<BlaXpirit> in /opt/crystal/src/io/file_descriptor_io.cr:52: undefined constant LibC::SEEK_CUR
<BlaXpirit> dang it
<BlaXpirit> TIL nobody has used file.tell
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
fowlduck has joined #crystal-lang
<crystal-gh> [crystal] lbguilherme opened pull request #1303: Fix #1302: File#tell: SEEK_CUR is a local constant (master...patch-1) http://git.io/vGIRQ
fowlduck has quit [Ping timeout: 245 seconds]
<dzv> missing pos/tell is probably missing from lack of time
blue_deref has joined #crystal-lang
<BlaXpirit> dzv, there are also differences, like `size` vs `bytesize`
<BlaXpirit> sure would be nice to have these classes interchangable
<BlaXpirit> i will write issue tomorrow and/or pullrequest
<BlaXpirit> i cant believe it actually works
<jhass> mmh, now I wonder if you can get function pointers to abstract methods
<BlaXpirit> jhass, apparently u can because this works
<jhass> nah, you got anonymous functions there, that's not what I mean
<BlaXpirit> oh
<BlaXpirit> well i tried it like that at first
<BlaXpirit> but something didn't work out, i don't remember what
<BlaXpirit> maybe the problem was exactly what you're saying
<BlaXpirit> any way to improve this code?
<jhass> >> abstract class Foo; abstract bar(a : String); getter f; def initialize; @f = ->bar(String); end; end; class Bar < Foo; def bar(a : String); "bar"; end; end; class Baz < Foo; def bar(a : String); "baz"; end; end; {Bar.new.f.call, Baz.new.f.call}
<DeBot> jhass: Syntax error in eval:4: unexpected token: bar - http://carc.in/#/r/d10
<jhass> mmh
<BlaXpirit> oh yeah, that's what. i didn't want to specify the exact type because it's kinda generic right now
<jhass> >> abstract class Foo; abstract def bar(a : String); getter f; def initialize; @f = ->bar(String); end; end; class Bar < Foo; def bar(a : String); "bar"; end; end; class Baz < Foo; def bar(a : String); "baz"; end; end; {Bar.new.f.call, Baz.new.f.call}
<DeBot> jhass: Error in line 4: wrong number of arguments for '(String -> String)#call' (0 for 1) - http://carc.in/#/r/d11
<jhass> >> abstract class Foo; abstract def bar(a : String); getter f; def initialize; @f = ->bar(String); end; end; class Bar < Foo; def bar(a : String); "bar"; end; end; class Baz < Foo; def bar(a : String); "baz"; end; end; {Bar.new.f.call(""), Baz.new.f.call("")}
<DeBot> jhass: # => {"bar", "baz"} - http://carc.in/#/r/d12
<jhass> nice, it works though
<BlaXpirit> jhass, why can't I replace BOX with typeof(@box) ?
<BlaXpirit> i mean typeof(@funcs)
<jhass> uh, guess the compiler sees a reference to @box and makes it a closure?
<BlaXpirit> yes, that's what happens.
<jhass> so simply not smart enough there ;)
<BlaXpirit> private alias doesn't work
<BlaXpirit> i don't want this BOX exposed
<BlaXpirit> (and no, i dont want to copy it over 4 times)
<jhass> private method and typeof that method?
<jhass> 50/50 it closures too or not
waj has joined #crystal-lang
<jhass> (private method that constructs @funcs)
<BlaXpirit> :D
<BlaXpirit> doesnt work
<BlaXpirit> same thing
<jhass> private def self.create_box(tuple) : Box({yada, yada, yada}); Box.new(tuple); end; ... typeof(InputStream.create_box) :P
<jhass> maybe not :P
<jhass> @funcs = InputStream.create_box({...})
<BlaXpirit> that could actually work
<jhass> yeah
<jhass> but it's cruel :P