00:05
<
crystal-gh >
[crystal] jhass opened pull request #1459: HTTP::Headers: Preserve input case, indifferent access between - and _ (master...headers_compare)
http://git.io/vZKJ5
00:06
<
jokke >
i tried to reproduce it
00:06
<
jokke >
but can't get any relevant results
00:07
<
jokke >
of course it's unlikely that it cascades down to the last else
00:09
<
jhass >
what's your LLVM version?
00:11
<
crystal-gh >
[crystal] jreinert closed pull request #1416: normalize dash/underscore separated http header names correctly (master...master)
http://git.io/vZmNr
00:16
<
jokke >
seems that the pr breaks some specs
00:17
<
jokke >
ah but those are fixed easily
00:24
kyrylo has quit [Ping timeout: 264 seconds]
00:27
MikeC has joined #crystal-lang
00:27
<
jokke >
yup that should do it
00:31
knoopx has quit [Remote host closed the connection]
00:31
<
MikeC >
Been playing with Crystal some and really like it (I'm a Rubiest). Am considering trying it out on some small web services. All the parts seem to be there (web frameworks, postgres driver) anyone doing this currently?
00:32
<
jhass >
>> "I'm all crystal on the backend ;)"
00:33
<
jhass >
jokke: if .. elseif .. else 32.39M (± 4.05%) fastest
00:33
<
jhass >
guard clause 32.09M (± 4.66%) 1.01× slower
00:33
<
jhass >
if I use RAND.next_bool || RAND.next_bool || RAND.next_bool
00:33
<
jhass >
for the conditions
00:33
<
jhass >
oh, actually I had the 300k difference before, didn't notice :/
00:33
<
MikeC >
Thanks jhass, anything obvious to watch out for?
00:34
<
jhass >
MikeC: not really, code's on jhass/carc.in
00:34
<
MikeC >
ok.. many thanks!
00:37
<
jhass >
jokke: yep, quite consistently ~200-500k faster for me. Do you have a good entropy source (like haveged)?
00:38
<
jhass >
might explain the bigger inconsistencies when using randomness then
00:41
<
jhass >
let's also try with cpu pinning
00:41
<
jokke >
if .. elseif .. else 39.6M (± 1.20%) fastest
00:41
<
jokke >
guard clause 39.55M (± 1.15%) 1.00× slower
00:41
<
jokke >
that's minimal
00:42
<
jokke >
ok now even 1.02x slower
00:44
<
jokke >
now if elseif was 1.01 slower
00:46
<
jhass >
interesting, I get less consistent results with cpu pinning ...
00:46
<
jhass >
I guess I leave it for now
00:46
<
jhass >
just hit a hard to optimize case I guess
01:02
Neverdie has joined #crystal-lang
01:02
<
jhass >
shit, Ary's right, the comparator is really slow
01:02
<
jhass >
just tried wrapping the key into a struct instead
01:02
<
jhass >
already looking good
01:05
<
jhass >
Fetch Content-Type from HTTP::Headers { "Content-Type" => "bar" }
01:05
<
jhass >
HeadersMaster 2.36M (±25.62%) 8.11× slower
01:05
<
jhass >
HeadersPR 17.9M (± 4.50%) 1.07× slower
01:05
<
jhass >
HeadersCompare 19.12M (± 3.13%) fastest
01:08
MikeC has quit [Quit: Page closed]
01:27
jeromegn_ has joined #crystal-lang
01:28
jeromegn has quit [Ping timeout: 250 seconds]
01:28
jeromegn_ is now known as jeromegn
01:35
trapped has joined #crystal-lang
01:56
<
dzv >
how do i make a common initialize method when there are other initialize methods with different arguments?
http://carc.in/#/r/f0n
02:02
<
jeromegn >
dzv: you'd need to call it with new and no arguments
02:02
<
jeromegn >
try new() instead of super()
02:02
<
jeromegn >
actually... not sure if that'll work
02:03
<
dzv >
it doesn't create an extra object?
02:19
buggs has quit [Quit: WeeChat 0.4.2]
02:23
sardaukar has quit [Ping timeout: 256 seconds]
02:25
wonderbread_ has joined #crystal-lang
02:27
wonderbreadz has quit [Ping timeout: 250 seconds]
02:27
wonderbread_ is now known as wonderbreadz
02:33
trapped has quit [Read error: Connection reset by peer]
02:52
<
crystal-gh >
crystal/master 75cd6ce Ary Borenszweig: Use T* instead of Pointer(T) in to_s for nodes inside libs
02:53
ponga has quit [Quit: Connection closed for inactivity]
02:55
leafybasil has joined #crystal-lang
03:17
leafybasil has quit [Remote host closed the connection]
03:17
leafybasil has joined #crystal-lang
03:22
leafybasil has quit [Ping timeout: 264 seconds]
03:30
sardaukar has joined #crystal-lang
03:32
kulelu88 has left #crystal-lang ["Leaving"]
04:06
MikeC has joined #crystal-lang
04:07
MikeC has quit [Client Quit]
04:51
<
jeromegn >
is there a way to create just a generic IO instance?
04:51
<
jeromegn >
I know it's a module...
04:51
<
jeromegn >
I'm trying to fake some IO stuff for specs
04:51
<
jeromegn >
going to look at the crystal specs...
04:52
<
wmoxam >
How do you specify a callback that takes multiple arguments in a C binding?
04:59
jeromegn has quit [Quit: jeromegn]
07:13
BlaXpirit has joined #crystal-lang
07:51
<
jsaak >
if true then 1 else 2 end
07:52
<
jsaak >
this does not work in crystal is it intentional?
07:52
<
BlaXpirit >
jsaak, `then` isn't a thing...
07:53
<
BlaXpirit >
u can replace it with `;` but best avoid this
08:05
buggs has joined #crystal-lang
08:09
<
jhass >
wmoxam: cb : (A, B -> R)
08:30
kyrylo has joined #crystal-lang
08:34
<
jsaak >
ok, there is also Hash not implementing Enumerable
08:38
<
BlaXpirit >
makes total sense
08:39
<
jhass >
jsaak: because we have autosplat and no tuple decomposition in block args (yet)
08:40
<
jhass >
*no autosplat
08:40
<
jhass >
so each; yield a; end; != each; yield a, b; end;, Enumerable requires the former, Hash provides the latter
08:41
<
jsaak >
so you planning to add this functionality?
08:42
<
jhass >
tuple decomposition is somewhat likely to happen, autosplat is still undecided I think
08:42
<
jsaak >
(i just want to help you mentioning the errors i encountered, maybe i found something new)
08:43
<
jsaak >
i did not found also any decimal data type, where 0.1+0.1+0.1 == 0.3 are there any?
08:44
<
jsaak >
or shall i write my own?
08:45
<
jhass >
we already use gmp for BigInt, should be fairly easy to do a first cheap BigDecimal with it too
08:45
<
jhass >
so that'd be a welcome contribution to stdlib I'd say ;)
08:46
<
jsaak >
fork crystal , make BigDecimal branch, create pull request?
08:47
<
jhass >
pretty much
08:49
willl has quit [Quit: Connection closed for inactivity]
08:51
<
jhass >
I'd also love to see Rational
08:51
<
jhass >
probably the most underused datatype in Ruby
08:52
<
jsaak >
it is very slow in ruby, that is why i avoided that
08:53
<
jsaak >
or was in 1.8 times, not sure about 2.x
08:54
<
jhass >
2.2 or 2.1 added a literal, maybe the improved it by now
08:54
<
jhass >
gmp has functions for it too I think, would be interesting how they compare at least
09:26
sardaukar has quit [Ping timeout: 256 seconds]
09:40
sardaukar has joined #crystal-lang
09:45
<
jsaak >
i also found that type reduction does not work for global variables
09:45
<
jsaak >
gives compile time error
09:46
apt-get has joined #crystal-lang
09:53
apt-get has quit [Ping timeout: 250 seconds]
09:54
nakilon has joined #crystal-lang
09:56
kyrylo has quit [Quit: Konversation terminated!]
09:57
kyrylo has joined #crystal-lang
09:58
<
jhass >
jsaak: they're global, so another thread might change them between you checking the value and then doing something on that assumption
09:58
<
jhass >
besides, don't use globals :P
09:58
<
jhass >
but the proper way to do that is to assign them to a local first
10:04
<
DeBot >
jhass: Set non_local_if.
10:16
apt-get has joined #crystal-lang
10:17
<
jsaak >
yeah global was a temporary hack to make this damned program compile, but still no luck :)
10:45
Ven has joined #crystal-lang
10:55
Ven has quit [Ping timeout: 256 seconds]
11:06
Ven has joined #crystal-lang
11:11
Ven has quit [Read error: Connection reset by peer]
11:16
Ven has joined #crystal-lang
11:22
Ven has quit [Read error: Connection reset by peer]
11:36
apt-get has quit [Read error: No route to host]
12:07
leafybasil has joined #crystal-lang
12:14
<
nakilon >
jhass, about catch/throw usage -- I'm about to minify an example from Ruby the code I'm currently working on
12:16
elia has joined #crystal-lang
12:18
<
nakilon >
the `some_list_of_lists` actually could have a lot of levels deep
12:18
<
nakilon >
*could be
12:19
<
nakilon >
yeah I could use `return` here, but it won't work if I need some things be done right after catch block but inside the lambda
12:22
elia has quit [Quit: Computer has gone to sleep.]
12:31
<
crystal-gh >
[crystal] jhass opened pull request #1461: Suggest to start with 0.1.0 in library template (master...template_version)
http://git.io/vZ69M
12:33
<
jhass >
nakilon: this is hard to argue on fake code, but if it gets that complex it probably warrants a class
12:33
<
nakilon >
hm, while it's not possible to run Ruby code using Crystal compiler, it should be trivial to run Crystal code using Ruby interpreter
12:34
<
jhass >
a mruby binding should actually be feasible :P
12:35
<
nakilon >
classes are for OOP, instantiating, inheritance -- here I just want to break through more than one loop stack, that is trivial and what the catch/throw are implemented in Ruby for
12:36
<
jhass >
funny that I never had a use for it in all the Ruby code I wrote then
12:37
<
jhass >
and I disagree, classes are for packing up related data and/or logic
12:37
<
nakilon >
you mean cleaning the namespace using modules
12:38
<
nakilon >
encapsulation
12:39
<
nakilon >
the one should use module instead of class in Ruby if he doesn't need instantiating
12:39
<
nakilon >
it's my point of view
12:42
havenwood has joined #crystal-lang
12:42
leafybasil has quit [Remote host closed the connection]
12:43
leafybasil has joined #crystal-lang
12:43
kyrylo has left #crystal-lang ["Konversation terminated!"]
12:43
<
jhass >
well sure, but that's not what I mean
12:47
leafybasil has quit [Ping timeout: 265 seconds]
13:06
Ven has joined #crystal-lang
13:12
Ven has quit [Ping timeout: 260 seconds]
13:26
leafybasil has joined #crystal-lang
13:37
<
crystal-gh >
crystal/master 8a84e68 Jonne Haß: Suggest to start with 0.1.0 in library template...
13:37
<
crystal-gh >
crystal/master f801fd3 Jonne Haß: Merge pull request #1461 from jhass/template_version...
13:39
<
crystal-gh >
crystal/master 500c772 Ary Borenszweig: Fixed TypeDef#to_s
14:00
jeromegn has joined #crystal-lang
14:01
<
crystal-gh >
crystal/master 7bfe196 Ary Borenszweig: Fixed spec
14:20
<
jeromegn >
How would I get the bytes representation of a Float64?
14:20
<
jeromegn >
or I guess, most types?
14:20
<
jeromegn >
for a string I used to_slice
14:20
<
jhass >
thing is there's no "the bytes representation"
14:22
<
jeromegn >
I guess 8 bytes of the memory starting at pointer x?
14:22
<
jeromegn >
apparently pointerof(self) doesn't work
14:22
<
jeromegn >
have to assign it before I guess so that it's in memory
14:23
Ven has joined #crystal-lang
14:23
<
jhass >
>> f = Float32::MAX; Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f))
14:23
<
jhass >
>> f = Float32::MAX; Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f)))
14:24
<
jhass >
idk if that makes any sense
14:24
<
jeromegn >
I was probably not using the right language
14:24
<
jeromegn >
*nomenclature
14:25
<
jhass >
I mean IEEE754 doesn't partition into bytes
14:26
<
jeromegn >
yea, I'm implementing the cryptic BSON spec
14:27
<
jhass >
>> f = Float64::MAX; Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f)))
14:27
<
jhass >
well, guess it's somewhat consistent
14:29
<
jeromegn >
>> n = 20.to_i32; Slice.new(pointerof(n) as UInt8*, sizeof(typeof(n)))
14:30
<
jeromegn >
>> n = 20.to_i32; s = Slice.new(pointerof(n) as UInt8*, sizeof(typeof(n))); b1,b2,b3,b4 = s; t32 = {b1, b2, b3, b4}; (pointerof(t32) as Int32*).value
14:30
<
jeromegn >
looks alright
14:31
<
jhass >
>> f = Float64::MAX; s = Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f))); (s.pointer as Float64*).value
14:31
<
jhass >
>> f = Float64::MAX; s = Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f))); (s[0] as Float64*).value
14:32
<
jhass >
>> f = Float64::MAX; s = Slice.new(pointerof(f) as UInt8*, sizeof(typeof(f))); (s.pointer(0) as Float64*).value
14:32
<
jhass >
>> Float64::MAX
14:33
<
jhass >
not sure that's a good idea
14:34
<
jeromegn >
yea me neither... at least for Floats, it seems off
14:34
<
jeromegn >
I<m trying to serialize stuff back to BSON
14:35
trapped has joined #crystal-lang
14:37
<
jeromegn >
so I'm passing around a IO instance and writing bytes ot it
14:45
kleech has joined #crystal-lang
14:46
<
kleech >
any ideas why require "net/http" does not work (can't find file)?
14:47
<
jeromegn >
jhass: ok it's def not reliable...
14:47
<
jhass >
kleech: it's http/client
14:49
<
jhass >
heh, it's a year old :P
14:49
<
jeromegn >
>> n = 6; r, w = IO.pipe; w.write Slice(UInt8).new(pointerof(n) as UInt8*, sizeof(typeof(n))); bytes = Slice(UInt8).new(sizeof(typeof(n))); r.read(bytes); bytes
14:50
<
jeromegn >
I guess it does work... weird, I'm getting different results locally. must be something else
14:50
<
jhass >
off by one? :P
14:51
Ven has quit [Read error: No route to host]
14:51
kleech has quit [Remote host closed the connection]
14:51
<
jeromegn >
off by two
14:51
<
jeromegn >
off by one was yesterday! jeeezzz
14:52
<
jhass >
gotta scale up somehow
14:53
<
jeromegn >
I'm storing [6, 0, 0, 0] but when reading the IO I get [4, 0, 0, 0]
14:54
<
jhass >
signed vs unsigned?
14:54
<
BlaXpirit >
jhass, that's not how it works :p
14:54
<
jhass >
mmh, no it's the second bit that's lost
14:54
<
jeromegn >
>> 6.to_u32
14:55
<
BlaXpirit >
>> n = -6; (pointerof(n) as Pointer(UInt32)).value
14:55
<
BlaXpirit >
thats more like it
15:00
<
jeromegn >
writing slices vs writing Arrays of UInt8 seems to yield different effects
15:00
<
jeromegn >
although very ugly
15:00
<
jeromegn >
but now that i'm writing slices, things are off...
15:00
<
jeromegn >
unless..
15:01
<
jeromegn >
I did switch from a StringIO to a normal IO thingy...
15:01
<
jeromegn >
>> r, w = IO.pipe; "#{r.class} #{w.class}"
15:01
<
BlaXpirit >
>> UInt8[2,5,3,2]
15:01
<
jeromegn >
interesting
15:01
<
BlaXpirit >
first time i see this
15:02
<
jeromegn >
I saw that in the message_pack lib I think
15:04
<
jeromegn >
nah same effect with StringIO
15:05
<
BlaXpirit >
jeromegn, isolate it and see what happens then
15:05
<
BlaXpirit >
i dont think array can be different from slice, if everything is done correctly
15:06
<
jeromegn >
I'm trying a few things, will report back! :)
15:09
<
jeromegn >
might have found a bug...
15:09
<
jeromegn >
0.7.7/src/io/file_descriptor_io.cr:245: undefined constant SEEK_SET
15:09
<
jeromegn >
seek(0, SEEK_SET)
15:09
<
jeromegn >
trying to rewind a FileDescriptorIO
15:11
<
jeromegn >
so even if I write 100, it still ends up as 4
15:11
apt-get has joined #crystal-lang
15:11
<
jeromegn >
but all the other writes are good
15:16
<
jeromegn >
also, those values change every time i run them
15:26
<
crystal-gh >
crystal/master fbf2eeb Ary Borenszweig: Use "T[N]" instead of "StaticArray(T, N)" when doing to_s inside lib def
15:29
<
BlaXpirit >
jeromegn, well duh. u have a pointer to unallocated memory
15:29
<
BlaXpirit >
just what i expected
15:29
<
jeromegn >
how do I fix that?
15:29
Neverdie has joined #crystal-lang
15:31
<
BlaXpirit >
jeromegn, this code structure isn't helping.. i dont know how to adapt this to it
15:31
<
jeromegn >
the code structure is off?
15:31
<
BlaXpirit >
basically you're copying `self` into `n`, then getting a pointer to `n`, then deleting `n`, so it points to whatever
15:32
<
BlaXpirit >
just don't make the copy. don't use an object's own method to return a pointer
15:33
<
jeromegn >
I can try that
15:34
<
jeromegn >
I inspired from String#to_slice which uses it cstr
15:34
<
jeromegn >
*its cstr
15:34
<
jeromegn >
I couldn't find an equivalent for Int so I tried using self, but you can't get a pointerof(self)
15:35
<
BlaXpirit >
also remember my warnings? is bson really endinanness-dependent?
15:37
<
jeromegn >
I remember :) I mean, I'm not 100% sure, but I saw that mentioned in different places
15:37
<
jeromegn >
this is how the ruby implementation does it:
15:38
<
BlaXpirit >
jeromegn, well they use pack, to which they specify byte order
15:39
<
jeromegn >
yea and they specify little-endian, right?
15:39
<
jeromegn >
s< l< q< | | little endian
15:39
<
jeromegn >
so I guess I can trust that, since MongoDB, Inc. wrote that thing
15:40
<
BlaXpirit >
jeromegn, yes, so they specify it, but when you fiddle with pointers you can't specify it, because you use whatever your computer uses
15:40
<
jeromegn >
oh, right
15:41
<
BlaXpirit >
then again, there are barely any big-endian computers (crystal probably doesnt support any)
15:41
<
jeromegn >
but given I wanted to be sure, how would I do it?
15:41
<
jeromegn >
manually rewrite the bytes order
15:42
<
BlaXpirit >
>> n = 123456; [n>>24, n>>16, n>>8, n].map &.to_u8
15:43
<
jeromegn >
oh yes you did mention that yesterday
15:43
<
BlaXpirit >
a = UInt8[0, 1, 226, 64]; (a[0].to_i<<24)&(a[1].to_i<<16)&(a[2].to_i<<8)&(a[3].to_i)
15:44
<
BlaXpirit >
>> a = UInt8[0, 1, 226, 64]; (a[0].to_i<<24)&(a[1].to_i<<16)&(a[2].to_i<<8)&(a[3].to_i)
15:44
<
BlaXpirit >
ok then :|
15:44
<
BlaXpirit >
>> a = UInt8[0, 1, 226, 64]; (a[0].to_i<<24) | (a[1].to_i<<16) | (a[2].to_i<<8) | (a[3].to_i)
15:50
Ven has joined #crystal-lang
16:05
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:37
ponga has joined #crystal-lang
16:38
<
jeromegn >
crystal spec ✱ ◼
16:38
<
jeromegn >
....Could not raise
16:40
<
jhass >
sounds like you messed up the stack :P
16:40
<
jeromegn >
I never do that
16:41
<
jeromegn >
that happens when I use the "should"
16:41
<
jeromegn >
in my spec
16:53
<
jeromegn >
BlaXpirit: How would I initially know what numbers to put in the UInt8[] bracket?
16:53
<
jeromegn >
sorry, my bad agan
16:56
<
asterite >
jeromegn: if that's on mac, try using the HEAD compiler, we "fixed" a bug related to that
16:56
<
asterite >
(the "Could not raise")
16:56
<
jeromegn >
yep, ok cool. for some reason it works fine now
17:00
<
jhass >
asterite: do you know what PartialComparable is about?
17:08
<
jeromegn >
how would I shift the bits for a Int64?
17:09
<
jeromegn >
for little-endianness
17:09
Ven has joined #crystal-lang
17:11
<
jeromegn >
oh I think I got it
17:16
<
jeromegn >
oh wait, I can't bit shift a float?
17:19
<
BlaXpirit >
jeromegn, oh :|
17:19
<
BlaXpirit >
for int64 that would be 56, 48, etc
17:20
<
jeromegn >
I think that'll work
17:20
<
jeromegn >
but not sure what to do about floats
17:20
<
BlaXpirit >
for a float i dont know...... i wonder if casting it to int64 then doing this would be any better than casting it to slice[uint8]
17:27
nakilon has quit [Ping timeout: 240 seconds]
17:28
Ven has quit [Ping timeout: 240 seconds]
17:36
<
jeromegn >
I'm not sure how to fix that, else I would've submitted a PR
17:36
<
jeromegn >
I can open an issue though
17:44
Ven has joined #crystal-lang
17:49
nakilon has joined #crystal-lang
17:50
willl has joined #crystal-lang
17:51
<
crystal-gh >
crystal/master c714a78 Ary Borenszweig: Missing "$" for ExternalVar#to_s
17:58
Ven has quit [Ping timeout: 246 seconds]
18:02
Ven has joined #crystal-lang
18:06
<
jhass >
?json_union
18:08
Ven has quit [Ping timeout: 268 seconds]
18:11
Ven has joined #crystal-lang
18:15
Ven has quit [Read error: Connection reset by peer]
18:29
blue_deref has joined #crystal-lang
18:42
trapped has quit [Read error: Connection reset by peer]
18:51
<
BlaXpirit >
they pack float completely manually
19:08
kulelu88 has joined #crystal-lang
19:24
<
jeromegn >
I mean, for now, just so my spec actually run and don't get a compile error, I swicthed it to Int64
19:36
blue_deref has quit [Quit: Taking myself out of hear.]
19:40
<
Papierkorb >
>> 0 as LibC::SizeT
19:41
<
jhass >
>> LibC::SizeT.cast(0)
19:41
<
Papierkorb >
jhass: just tried that because I see the as keyword used elsewhere, so that would be consistent to me
19:42
<
jhass >
I should try to get cast renamed
19:42
<
jhass >
it's conversion actually, not casting
19:42
<
jhass >
invokes the right .to_x on the argument based on the receiver
19:43
Neverdie has joined #crystal-lang
19:46
<
jhass >
convert is too long, maybe from or conv
19:47
<
willl >
hm, convert might not be too long
19:48
<
jhass >
from gives nice symmetry with to_x IMO
19:51
<
willl >
yeah that's a good point
20:26
<
BlaXpirit >
could even be called `new`
20:26
<
BlaXpirit >
yes, `cast` is not good
20:29
jeromegn has quit [Ping timeout: 252 seconds]
20:30
<
jhass >
mmh, new is not a bad idea too
20:36
Ven has joined #crystal-lang
20:40
<
BlaXpirit >
especially looking at things like String.new(pointer)
20:48
nakilon has quit [Ping timeout: 255 seconds]
21:11
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:13
toydestroyer has quit [Remote host closed the connection]
21:14
toydestroyer has joined #crystal-lang
21:17
<
asterite >
"from" sounds good, better than "cast" and same amount of letters :)
21:18
apt-get has quit [Remote host closed the connection]
21:18
<
asterite >
And the "as_cast" is a pretty nice trick, I guess it's the same as "x as Int32" but you can do it with a runtime value?
21:18
<
asterite >
Like, a = Int32; a.as_cast(1) ?
21:19
<
willl >
asterite: regarding as_cast, yes. in crystal-pg you can pass in the types you want out, and the query, and then it does the as cast, to avoid union types.
21:27
<
jhass >
asterite: the more I think about it the more does using new grow on me, and it's even shorter. But at the end of the day I'd even live with convert, I just want to get rid of cast
21:29
<
asterite >
"new" can work too, yes. The problem is that "new" (and "initialize") are special for the compiler, because the lookup rules are slightly different
21:30
<
asterite >
It's a bit long to explain here, but it's because they play a role in determining nilablility of fields
21:30
<
jhass >
yeah I saw the commits, nice progres
21:31
<
asterite >
You can try running src/main.cr and see what it prints. The idea is to simplify a lot the way to write C bindings, which right now is pretty boring and bug prone
21:31
<
asterite >
but right now it only works on mac. Oh, and we'll integrate that into the compiler, it won't be a separate tool :)
21:31
<
asterite >
But this week waj told me he'll also like to review the many pending pull requests, so we hope to get the count down
21:32
<
jhass >
that's good
21:32
<
jhass >
back to cast, is there a specific problem you see if we'd just rename the current cast methods to new?
21:33
<
asterite >
We also want a way to have a lib next to a .c/.h file and some way to compile and link that in an easy way, so you can write C code, mostly for interop, not so much for performance
21:33
<
asterite >
We can try with "new" and see what happens
21:34
<
asterite >
I don't know why that doesn't work, might be a bug or something related to "new"... but if it's called "from" it works
21:34
<
asterite >
But since that "new" will be in every leaf type (Int32, etc.) it might not be a problem
21:46
BlaXpirit has quit [Quit: Konversation]
21:49
havenwood has quit [Ping timeout: 244 seconds]
22:10
<
crystal-gh >
[crystal] jhass opened pull request #1465: Rename the cast class method to new (master...no_cast)
http://git.io/vZPQ6
22:34
[spoiler] has quit [*.net *.split]
22:34
lokulin has quit [*.net *.split]
22:37
[spoiler] has joined #crystal-lang
22:48
lokulin has joined #crystal-lang
23:02
<
crystal-gh >
crystal/master c94c5a7 Ary Borenszweig: Fixed #1463: SEEK_SET still references in FileDescriptorIO
23:02
<
crystal-gh >
crystal/master 42690c4 Ary Borenszweig: Fixed #1455: incorrect length returned in XML parse IO callback
23:03
ponga has quit [Quit: Connection closed for inactivity]
23:30
Raimondi has quit [Ping timeout: 264 seconds]
23:45
<
crystal-gh >
[crystal] asterite closed pull request #1465: Rename the cast class method to new (master...no_cast)
http://git.io/vZPQ6
23:46
<
crystal-gh >
crystal/master a590c6e Ary Borenszweig: Changed a few "cast" to "new'
23:49
lokulin has joined #crystal-lang
23:49
lokulin has quit [Changing host]