00:09
waj has quit [Remote host closed the connection]
00:14
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
00:14
tatey_ has joined #crystal-lang
00:23
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
00:27
dylanmei has quit [Quit: ZZZzzz…]
00:58
leafybas_ has joined #crystal-lang
00:58
leafybasil has quit [Read error: Connection reset by peer]
01:05
elbow_jason has quit [Quit: Leaving]
01:25
ylluminate has quit [Ping timeout: 256 seconds]
01:28
kyrylo has quit [Ping timeout: 255 seconds]
01:51
<
crystal-gh >
[crystal] technorama opened pull request #1292: IO.close cleanup. (master...f/io_close)
http://git.io/vsjlP
01:58
ylluminate has joined #crystal-lang
03:49
elbow_jason has joined #crystal-lang
03:58
no0p has quit [Ping timeout: 246 seconds]
04:04
no0p has joined #crystal-lang
04:09
fowlduck has joined #crystal-lang
04:15
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
04:35
fowlduck has quit [Remote host closed the connection]
04:58
elbow_jason has quit [Ping timeout: 260 seconds]
05:23
kulelu88 has quit [Quit: Leaving]
05:36
fowlduck has joined #crystal-lang
05:39
fowlduck_ has joined #crystal-lang
05:39
fowlduck has quit [Read error: Connection reset by peer]
05:39
ssvb has quit [Ping timeout: 250 seconds]
05:57
fowlduck_ is now known as fowlduck
06:33
<
fowlduck >
huh, the homebrew for crystal is out of date
06:34
<
fowlduck >
oh, need to tap
06:39
<
fowlduck >
soooo happy that crystal is going M-N threading
06:43
<
vegai >
it is? Cool, I guess.
06:43
<
vegai >
never gotten into that debate too much
06:44
<
fowlduck >
at least M-M
06:44
<
fowlduck >
going single-threaded would be such a waste
06:46
<
fowlduck >
really hoping they don't straight copy ruby's URI
06:47
<
fowlduck >
looks like they're targeting a more modern rfc, so that's good
06:49
<
fowlduck >
well, the most modern, for uri, I think
06:49
<
fowlduck >
ruby's uri is busted as hell
06:50
<
vegai >
wasn't it Rust who went M-M?
06:51
<
fowlduck >
wouldn't surprise me
06:51
<
vegai >
ah, yes Daniel
06:52
<
vegai >
I guess they went eventually to support both models through the library
06:53
<
vegai >
although that thread is 2 years old already, lots of things happened after
06:55
<
fowlduck >
ah, interesting points there that I wasn't aware of
06:58
<
fowlduck >
some solid reasons to go M:M
07:07
<
fowlduck >
iiiinteresting
07:54
<
dzv >
is there a way to run a private method for debugging?
07:59
<
jhass >
class Foo; def foo; private_method; end; end;
08:17
sdogruyol has quit [Read error: Connection reset by peer]
08:17
sdogruyo_ has joined #crystal-lang
08:17
BlaXpirit has joined #crystal-lang
08:20
<
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
08:21
<
jhass >
if you can pass a "user_data" or somesuch param along, there's a workaround
08:21
<
jhass >
if not, not without a global
08:25
<
dzv >
this function doesn't have one
08:25
<
jhass >
then you would've have register a function that uses for example a global hash to lookup the right handler to call
08:26
<
jhass >
or a singleton could work too I guess
08:34
tatey_ has joined #crystal-lang
08:38
leafybas_ has quit [Remote host closed the connection]
08:45
sdogruyo_ has quit [Read error: Connection reset by peer]
08:49
sdogruyol has joined #crystal-lang
09:01
kyrylo has joined #crystal-lang
09:03
<
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
09:18
leafybasil has joined #crystal-lang
09:18
sdogruyol has quit [Read error: Connection reset by peer]
09:21
sdogruyol has joined #crystal-lang
09:24
<
Netfeed >
jhass: shouldn't shell be an argument aswell, that maybe defaults to /bin/sh ?
09:26
<
jhass >
Netfeed: maybe, but I want to keep the conflict potential minimal for this PR
09:34
Ven has joined #crystal-lang
09:37
<
BlaXpirit >
dzv, are u still here?
09:38
<
BlaXpirit >
oh, your function really doesn't have a user_data :(
09:39
<
dzv >
the library doesn't
09:40
<
BlaXpirit >
jhass helped me with this a long time ago. so helpful, this "box"
09:43
sdogruyol has quit [Read error: Connection reset by peer]
09:48
sdogruyol has joined #crystal-lang
09:56
kyrylo has quit [Quit: Konversation terminated!]
09:56
kyrylo has joined #crystal-lang
09:58
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
10:15
Ven has joined #crystal-lang
10:20
sdogruyol has quit [Remote host closed the connection]
10:34
ssvb has joined #crystal-lang
10:39
<
dzv >
does anyone have a program that forks?
10:39
<
dzv >
or does signal handling?
10:46
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
10:50
<
crystal-gh >
[crystal] technorama opened pull request #1295: Waitpid enhancements: (master...f/nowait_pid)
http://git.io/vGvcX
10:56
<
RX14 >
you could totally include a singleton macro in the standard library
11:05
Ven has joined #crystal-lang
11:08
Ven has quit [Client Quit]
11:16
sdogruyol has joined #crystal-lang
11:22
Ven has joined #crystal-lang
11:32
<
jhass >
could be seen as parser bug I guess
11:32
<
jhass >
as Constant, Constant is parsed as an expression
11:33
<
tatey_ >
Ah, okay. Should I raise an issue?
11:33
<
jhass >
I bet LibC.recvfrom(fd, (slice.to_unsafe as Void*), LibC::SizeT.cast(count), 0, nil, nil) would work
11:33
<
jhass >
not sure, maybe
11:33
<
jhass >
depends on how you feel about it/whether you want to argue for a case :P
11:34
<
tatey_ >
Yeah, it does
11:34
<
tatey_ >
As in, yes, wrapping in parans works
11:36
<
tatey_ >
Thanks :-)
11:44
ssvb has quit [Ping timeout: 255 seconds]
11:44
sdogruyol has quit [Remote host closed the connection]
11:47
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
11:59
Ven has joined #crystal-lang
12:10
shadeslayer has quit [Ping timeout: 250 seconds]
12:12
shadeslayer has joined #crystal-lang
12:17
shadeslayer has quit [Ping timeout: 260 seconds]
12:17
shadeslayer has joined #crystal-lang
12:25
sdogruyol has joined #crystal-lang
12:26
sdogruyol has quit [Remote host closed the connection]
12:29
sdogruyo_ has joined #crystal-lang
12:29
fowlduck has quit [Remote host closed the connection]
12:44
sdogruyo_ has quit [Remote host closed the connection]
12:57
dylanmei has joined #crystal-lang
13:01
<
crystal-gh >
crystal/master ef58475 Ary Borenszweig: Use `Process.run` instead of `system` for linker command. Related to #300
13:10
<
jhass >
that might be good, but I'd still like it to zero the memory tbh
13:10
<
jhass >
or maybe have unsafe_out if you need the performance of not doing it
13:11
<
jhass >
or yet better have a flag on the fun definition on whether to do it or not, with the default of doing it
13:24
fowlduck has joined #crystal-lang
13:29
fowlduck has quit [Ping timeout: 250 seconds]
13:29
NeverDie has joined #crystal-lang
13:31
dylanmei has quit [Quit: ZZZzzz…]
13:34
<
BlaXpirit >
I'm wondering what's the best way to tell crystal doc to generate documentation for only one module
13:36
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
13:40
ssvb has joined #crystal-lang
13:44
havenwood has joined #crystal-lang
13:45
sdogruyol has joined #crystal-lang
13:50
blue_deref has joined #crystal-lang
13:52
<
dzv >
is there an Module.included type of method?
13:52
<
jhass >
there's a macro included hook
13:54
<
dzv >
i don't see it
14:19
waj has joined #crystal-lang
14:34
sdogruyol has quit [Read error: Connection reset by peer]
14:39
sdogruyol has joined #crystal-lang
14:42
luislavena has joined #crystal-lang
14:43
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
14:52
blassin has joined #crystal-lang
14:53
<
blassin >
I have a weird issue with my code
14:53
<
blassin >
I have a hash with lambdas as keys, and I can't access its keys somehow
14:53
<
BlaXpirit >
blassin, "lambdas"?
14:53
<
blassin >
if I try printing hash.keys, I get a no overload matches error
14:54
<
BlaXpirit >
please elaborae and show an example
14:54
<
blassin >
INSTRUCTION_DICTIONARY = { "sub" => ->(e: ExC) { Arithmetic.sub e } }
14:54
<
blassin >
if I try to print INSTRUCTION_DICTIONARY.keys, I get the error
14:54
<
blassin >
but without the print, the code works!
14:55
<
blassin >
this is used with INSTRUCTION_DICTIONARY[instruction.name].call exc
14:55
<
blassin >
I don't know why I can't print the keys of the hash!
14:56
<
BlaXpirit >
blassin, i cannot reproduce
14:56
<
blassin >
would you like a look at the code?
14:56
<
blassin >
I'll DM it
14:56
* blassin
slaps BlaXpirit around a bit with a large fishbot
14:58
<
jhass >
it's a secret?
14:59
Ven has joined #crystal-lang
15:00
ssvb has quit [Ping timeout: 244 seconds]
15:02
<
blassin >
jhass: no, just a lot of code :D
15:02
<
blassin >
jhass: do you want to have a look too?
15:02
<
jhass >
if it's on github/gist
15:03
<
blassin >
I use MadEye.io
15:03
<
BlaXpirit >
i have no idea what's going on there
15:09
sdogruyol has quit [Remote host closed the connection]
15:13
ssvb has joined #crystal-lang
15:14
<
crystal-gh >
crystal/master 70caaca Ary Borenszweig: Removed duplicate properties from FileDescriptorIO
15:14
<
crystal-gh >
crystal/master 09989c5 Ary Borenszweig: Fixed #1294: Inconsistent variance in generics
15:30
blue_deref has quit [Quit: bbn]
15:32
<
blassin >
shouldn't #clone return a copy of an object?
15:33
<
blassin >
or is it still by reference?
15:33
havenwood has joined #crystal-lang
15:33
<
jhass >
a shallow copy I think
15:33
<
blassin >
Object.clone says "Returns a deep copy of this object."
15:33
<
blassin >
shallow is #dup
15:34
<
blassin >
I tried cloning an object, but the clone seems to act by reference
15:34
<
jhass >
"Object returns self, but subclasses override this method to provide specific clone behaviour."
15:35
<
blassin >
and if my subclasses have not?
15:35
<
jhass >
they get Object's obviously
15:35
<
blassin >
I don't get it, the carc.in I posted confuses me
15:36
<
jhass >
I guess Array doesn't override it either yet
15:36
<
jhass >
mmh, it does
15:36
<
jhass >
ah, but you clone your own
15:37
<
jhass >
so, the above applies
15:37
<
blassin >
but I didn't specify a clone behavior
15:37
<
jhass >
you have your custom class, you don't implement clone so you get Object's, which returns self
16:08
emancu has joined #crystal-lang
16:09
emancu has quit [Client Quit]
16:10
sdogruyol has joined #crystal-lang
16:13
waj has quit [Read error: Connection reset by peer]
16:13
waj_ has joined #crystal-lang
16:35
luislavena has quit [Remote host closed the connection]
16:39
<
crystal-gh >
crystal/master d986486 Ary Borenszweig: Disallow using `out x` if `x` is already defined
16:39
<
crystal-gh >
crystal/master c7d4f74 Ary Borenszweig: Allow `out _`
16:43
luislavena has joined #crystal-lang
16:45
dylanmei has joined #crystal-lang
16:50
<
BlaXpirit >
if i have [0, 1, 2, 3, 4], how can i iterate over {0, 1}, {1, 2}, {2, 3}, {3, 4} ?
16:51
<
jhass >
.each_cons(2)
16:51
<
jhass >
at least in ruby, let's see
16:52
<
BlaXpirit >
yeah, googling "ruby pairwise python" told me this
16:52
<
jhass >
>> (0..4).each_cons(2)
16:52
<
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
16:52
<
jhass >
>> (0..4).each_cons(2).to-a
16:52
<
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
16:52
<
jhass >
>> (0..4).each_cons(2).to_a
16:52
<
BlaXpirit >
:o that's nice, thanks
16:52
<
jhass >
well, it's arrays since it's parametric, but yeah
16:57
<
crystal-gh >
[crystal] kirbyfan64 opened pull request #1298: Refactor some code related to handling type specifics error (master...refactor-gen)
http://git.io/vGTvh
16:57
luislavena has quit [Remote host closed the connection]
16:58
qard has joined #crystal-lang
17:00
waj_ has quit [Remote host closed the connection]
17:01
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:02
dylanmei has quit [Ping timeout: 256 seconds]
17:08
blassin has quit [Quit: Page closed]
17:12
<
crystal-gh >
crystal/master bf284d9 Ryan Gonzalez: Refactor some code related to handling type specifics error
17:12
<
crystal-gh >
crystal/master 67ee5ad Ryan Gonzalez: Fix a comment typo
17:12
<
crystal-gh >
crystal/master 63be5f9 Ary Borenszweig: Merge pull request #1298 from kirbyfan64/refactor-gen...
17:13
dylanmei has joined #crystal-lang
17:18
leafybasil has quit [Remote host closed the connection]
17:19
leafybasil has joined #crystal-lang
17:23
leafybasil has quit [Ping timeout: 250 seconds]
17:24
fowlduck has joined #crystal-lang
17:35
luislavena has joined #crystal-lang
17:42
shama has joined #crystal-lang
17:59
waj has joined #crystal-lang
18:00
luislavena has quit [Remote host closed the connection]
18:05
elbow_jason has joined #crystal-lang
18:12
dyulax has joined #crystal-lang
18:13
luislavena has joined #crystal-lang
18:14
<
BlaXpirit >
dyulax, there was someone who make a room in "slack" and many suggested "gitter"
18:17
<
dyulax >
i don't know if i still didn't find the right irc client
18:17
<
dyulax >
or if they all are awfull
18:17
<
BlaXpirit >
i dont know
18:17
<
dyulax >
and bitter looks so cool... :)
18:18
<
BlaXpirit >
i'm just using the default IRC client of KDE and i know it's the best
18:18
<
jhass >
I was happy with pidgin long enough but invested the time to properly setup weechat
18:19
<
jhass >
which allowed my idling to go from < 10 channels to uh, dunno, > 30
18:24
dyulax_ has joined #crystal-lang
18:24
dyulax has quit [Quit: Saindo]
18:24
dyulax_ is now known as dyulax
18:24
dyulax has quit [Remote host closed the connection]
18:26
dyulax has joined #crystal-lang
18:27
leafybasil has joined #crystal-lang
18:57
luislavena has quit [Ping timeout: 244 seconds]
18:58
luislavena has joined #crystal-lang
18:59
fowlduck has quit [Remote host closed the connection]
19:05
fowlduck has joined #crystal-lang
19:06
<
crystal-gh >
crystal/master d32e6c7 Ary Borenszweig: Removed `BufferedIO` and renamed `BufferedIOMixin` to `BufferedIO`
19:06
<
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.
19:14
<
crystal-gh >
crystal/master bec13b1 Felix Scheinost: Readline.bind_key and Readline.done added
19:14
<
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
19:14
<
crystal-gh >
crystal/master 38e66f8 Felix Scheinost: Changed Readline.bind_key handling to use a global dict; Added unbind_key
19:14
Ven has joined #crystal-lang
19:42
emancu has joined #crystal-lang
19:52
<
crystal-gh >
crystal/master 92b0893 Ary Borenszweig: Fixed: `responds_to?` didn't work well with virtual types
20:09
<
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
20:10
<
jhass >
>> class Foo(T); end; module Bar; end; class A; include Bar; end; h = Hash(Symbol, Foo(Bar)).new; h[:a] = Foo(A).new
20:10
<
jhass >
>> class Foo(T); end; module Bar; end; class A; include Bar; end; h = Hash(Symbol, Foo(Bar)).new; h[:a] = Foo(Bar).new
20:12
<
jhass >
ah great, back to Bug: trying to downcast HTTP::ChunkedContent <- HTTP::FixedLengthContent
20:17
waj has quit [Read error: Connection reset by peer]
20:17
waj_ has joined #crystal-lang
20:27
waj_ has quit [Read error: Connection reset by peer]
20:27
waj has joined #crystal-lang
20:29
luislavena has quit [Remote host closed the connection]
20:30
n0xff has quit [Ping timeout: 272 seconds]
20:31
luislavena has joined #crystal-lang
20:35
<
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)
20:35
<
asterite >
how can I reproduce HTTP::ChunkedContent <- HTTP::FixedLengthContent?
20:35
<
jhass >
run DeBot's main.cr with Crystal HEAD
20:36
<
jhass >
doesn't seem to happen with 0.7.6
20:36
<
jhass >
let me push the alias_method "fix" :(
20:37
<
jhass >
trying to reduce it atm
20:38
<
jhass >
asterite: oh and Hash(String, PluginContainer(Plugin)).new seems to work for now
20:38
<
jhass >
er Framework::Plugin to get the right one in that context
20:48
<
BlaXpirit >
>> class A; end; abstract class B < A; abstract def f(x: Int32): Int32; end; class C < B; end; C.new
20:52
fowlduck has quit [Remote host closed the connection]
20:54
waj has quit [Remote host closed the connection]
20:55
<
jhass >
asterite: require "http/client"; HTTP::Client.get("") seems to reproduce on head
20:57
<
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.
20:57
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:05
<
jhass >
did you bisect?
21:07
dylanmei has quit [Quit: ZZZzzz…]
21:07
<
asterite >
Manually
21:08
<
jhass >
let me bisect, I have a hunch it's older
21:09
<
asterite >
No, it happens if I put a return type to IO#read
21:11
<
asterite >
Hm, well, it's hard, because it's that combined with something else
21:15
<
asterite >
now I'll need to reduce it, of course
21:24
dyulax has quit [Quit: Saindo]
21:25
<
crystal-gh >
crystal/master 084ec07 Ary Borenszweig: Fixed JSON parsing regarding whitespace. Related to #1299
21:25
<
crystal-gh >
crystal/master 119f8ab Ary Borenszweig: BitArray can be a struct
21:25
<
crystal-gh >
crystal/master efd9bb2 Ary Borenszweig: Some more docs
21:25
<
asterite >
jhass: I just fixed it... mmm... when I found the bug it didn't feel good :(
21:27
<
asterite >
The problem was that I was accidentally overwriting the `self_type` variable
21:27
<
jhass >
sounds like too big methods
21:27
<
asterite >
Yes, that's why I extracted that part to a sub-method
21:28
<
asterite >
The method is still big, though. It was small in the beginning but grew over time
21:29
<
jhass >
my limit is about half a screen, of whatever screen I happen to use :P
21:29
<
jhass >
but what helped me really a lot more than counting lines is the "same level of abstraction" rule
21:30
<
jhass >
that is trying to keep the "level of knowledge" inside a method the same
21:31
<
jhass >
it's vague I know, it's about things like logic for constructing a thing vs logic deciding which elements to include it
21:32
<
jhass >
I also like to extract predicates
21:33
<
jhass >
if foo.bar == baz -> if is_it_a_baz?(foo)
21:34
<
jhass >
and in doubt your methods really can't be small enough
21:44
DeBot has quit [Ping timeout: 250 seconds]
21:46
DeBot has joined #crystal-lang
21:49
luislavena has quit []
21:49
<
crystal-gh >
[crystal] technorama opened pull request #1300: New method: Exception#inspect_with_backtrace (master...f/exception_print)
http://git.io/vGIJW
22:03
tatey_ has joined #crystal-lang
22:05
<
BlaXpirit >
how can I turn a slice back to a pointer+size?
22:08
<
jhass >
.pointer and .size?
22:08
<
crystal-gh >
[crystal] luislavena opened pull request #1301: Travis: define inclusion rules instead of exclusion (master...explicit-travis-ci)
http://git.io/vGIqJ
22:08
fowlduck has joined #crystal-lang
22:09
<
BlaXpirit >
jhass, there is no .size, and length returns item count
22:09
<
BlaXpirit >
i thought of something
22:10
<
BlaXpirit >
(slice.pointer as Pointer(UInt8) - (slice.pointer+slice.length) as Pointer(UInt8))
22:10
luislavena has joined #crystal-lang
22:11
<
jhass >
well, you construct a slice with the item count, not the bytesize
22:11
<
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))}
22:12
<
jhass >
but wouldn't just .length * sizeof(.value) give the bytesize?
22:12
<
BlaXpirit >
this is what i want. i should've said that i actually want Pointer(Void) and byte size
22:12
<
BlaXpirit >
jhass, perhaps it would
22:12
<
jhass >
er, sizeof(typeof(.value)
22:13
fowlduck has quit [Ping timeout: 240 seconds]
22:13
<
BlaXpirit >
slice.pointer is kinda strange btw. it requires an argument and only does errorchecking with it
22:13
<
BlaXpirit >
i mean, i get the point, but it's strange
22:14
<
BlaXpirit >
>> slice = Slice(Int32).new(5, 123); {slice.to_unsafe as Pointer(Void), slice.length * sizeof(typeof(slice[0]))}
22:14
<
BlaXpirit >
that's nice, thanks.
22:29
luislavena has quit []
22:51
<
BlaXpirit >
hmm, the IO hierarchy is so strange
22:51
<
BlaXpirit >
also I really wish StringIO and File had a similar API
22:52
<
BlaXpirit >
StringIO should have `seek`, `tell`
22:52
<
BlaXpirit >
are there any arguments against it?
23:04
<
BlaXpirit >
in /opt/crystal/src/io/file_descriptor_io.cr:52: undefined constant LibC::SEEK_CUR
23:04
<
BlaXpirit >
dang it
23:06
<
BlaXpirit >
TIL nobody has used file.tell
23:08
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
23:09
fowlduck has joined #crystal-lang
23:11
<
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
23:14
fowlduck has quit [Ping timeout: 245 seconds]
23:18
<
dzv >
missing pos/tell is probably missing from lack of time
23:21
blue_deref has joined #crystal-lang
23:22
<
BlaXpirit >
dzv, there are also differences, like `size` vs `bytesize`
23:22
<
BlaXpirit >
sure would be nice to have these classes interchangable
23:23
<
BlaXpirit >
i will write issue tomorrow and/or pullrequest
23:42
<
BlaXpirit >
i cant believe it actually works
23:44
<
jhass >
mmh, now I wonder if you can get function pointers to abstract methods
23:44
<
BlaXpirit >
jhass, apparently u can because this works
23:44
<
jhass >
nah, you got anonymous functions there, that's not what I mean
23:45
<
BlaXpirit >
well i tried it like that at first
23:45
<
BlaXpirit >
but something didn't work out, i don't remember what
23:46
<
BlaXpirit >
maybe the problem was exactly what you're saying
23:46
<
BlaXpirit >
any way to improve this code?
23:46
<
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}
23:47
<
BlaXpirit >
oh yeah, that's what. i didn't want to specify the exact type because it's kinda generic right now
23:47
<
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}
23:47
<
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("")}
23:48
<
jhass >
nice, it works though
23:48
<
BlaXpirit >
jhass, why can't I replace BOX with typeof(@box) ?
23:49
<
BlaXpirit >
i mean typeof(@funcs)
23:49
<
jhass >
uh, guess the compiler sees a reference to @box and makes it a closure?
23:50
<
BlaXpirit >
yes, that's what happens.
23:50
<
jhass >
so simply not smart enough there ;)
23:50
<
BlaXpirit >
private alias doesn't work
23:50
<
BlaXpirit >
i don't want this BOX exposed
23:51
<
BlaXpirit >
(and no, i dont want to copy it over 4 times)
23:51
<
jhass >
private method and typeof that method?
23:51
<
jhass >
50/50 it closures too or not
23:51
waj has joined #crystal-lang
23:52
<
jhass >
(private method that constructs @funcs)
23:53
<
BlaXpirit >
doesnt work
23:53
<
BlaXpirit >
same thing
23:55
<
jhass >
private def self.create_box(tuple) : Box({yada, yada, yada}); Box.new(tuple); end; ... typeof(InputStream.create_box) :P
23:55
<
jhass >
maybe not :P
23:56
<
jhass >
@funcs = InputStream.create_box({...})
23:56
<
BlaXpirit >
that could actually work
23:56
<
jhass >
but it's cruel :P