00:05
vikaton has joined #crystal-lang
00:10
jokke1 is now known as jokke
00:11
<
jokke >
how can i use "self" in macros?
00:11
<
jokke >
i have a macro like the following
00:14
<
jokke >
>> class Foo; macro define_method(name); def {{name}}_test; puts "hi"; end; def {{name}}; self.{{name}}_test; end; define_method foo; end; Foo.new.foo
00:19
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
00:19
<
jokke >
my use case is slightly different
00:20
grindhold_ has joined #crystal-lang
00:21
grindhold has quit [Quit: No Ping reply in 180 seconds.]
00:30
juancate_ has joined #crystal-lang
00:32
qard has joined #crystal-lang
00:35
jhass has quit [*.net *.split]
00:35
asie has quit [*.net *.split]
00:35
juancate has quit [*.net *.split]
00:35
Kilo`byte has quit [*.net *.split]
00:36
jhass|off has joined #crystal-lang
00:36
Kilo`byte has joined #crystal-lang
00:36
jhass|off is now known as jhass
00:42
asie has joined #crystal-lang
00:44
Neverdie has joined #crystal-lang
00:51
jsaak has quit [Ping timeout: 246 seconds]
00:57
jsaak has joined #crystal-lang
01:02
CraigBuchek has joined #crystal-lang
01:04
nakilon has joined #crystal-lang
01:08
nakilon has quit [Ping timeout: 250 seconds]
01:19
jsaak has quit [Ping timeout: 246 seconds]
01:19
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
01:19
jsaak has joined #crystal-lang
01:33
havenwood has joined #crystal-lang
01:47
havenwood has quit [Max SendQ exceeded]
02:07
havenwood has joined #crystal-lang
02:15
vikaton has quit [Quit: Connection closed for inactivity]
02:26
sadin has joined #crystal-lang
02:28
asie has quit [*.net *.split]
02:28
asie has joined #crystal-lang
02:46
CraigBuchek has quit [Quit: Leaving.]
02:54
emancu has joined #crystal-lang
03:03
kulelu88 has quit [Quit: Leaving]
03:05
nakilon has joined #crystal-lang
03:09
nakilon has quit [Ping timeout: 260 seconds]
04:14
<
emancu >
Hello! does anybody knows if exist an implementation of Ruby's rack lib in Crystal ?
04:47
pawnbox_ has joined #crystal-lang
05:00
pawnbox_ has quit [Remote host closed the connection]
05:21
trapped has joined #crystal-lang
05:38
havenwood has quit [Remote host closed the connection]
05:45
konsolebox has joined #crystal-lang
05:52
trapped has quit [Read error: Connection reset by peer]
05:52
konsolebox has left #crystal-lang ["Leaving"]
05:58
<
dzv >
server = Server.new(8080) { |req| HTTP::Response.ok("text/plain", "OK") }
05:58
<
dzv >
it's not exactly rack but it's easy to use. see spec/std/http/server_spec.cr for examples.
06:09
<
crystal-gh >
[crystal] technorama opened pull request #1491: fork returns a Process. Small resource leak fixed. (master...f/fork_process)
http://git.io/vZNYd
06:11
dyulax93 has quit [Read error: Connection reset by peer]
06:12
dyulax93 has joined #crystal-lang
06:12
dyulax has quit [Read error: Connection reset by peer]
06:12
dyulax has joined #crystal-lang
06:33
pawnbox has joined #crystal-lang
06:34
<
pawnbox >
Just a small question.
06:35
<
pawnbox >
What the rationale behind No autosplat?
06:35
nakilon has joined #crystal-lang
06:46
pawnbox has quit [Ping timeout: 255 seconds]
07:29
pawnbox_ has joined #crystal-lang
07:29
elia has joined #crystal-lang
07:38
nakilon has quit [Ping timeout: 240 seconds]
07:54
Ven has joined #crystal-lang
07:56
<
crystal-gh >
crystal/master e13fe25 Victor Bergoo: HTTP Cookie handling
07:56
<
crystal-gh >
crystal/master e94e7f8 Julien Portalier: Merge pull request #1252 from netfeed/http_cookie...
07:59
<
crystal-gh >
[crystal] jhass closed pull request #1470: Add Number.clamp. (master...f/range_clamp)
http://git.io/vZM0U
08:01
elia has quit [Read error: Connection reset by peer]
08:01
elia has joined #crystal-lang
08:02
BlaXpirit has joined #crystal-lang
08:09
<
Netfeed >
oh, come on!
08:12
<
Netfeed >
that doesn't look like my fault
08:32
<
jhass >
Netfeed: no that seems like a random bug
08:39
<
Netfeed >
good, well, not good, but good for me
08:42
<
pawnbox_ >
>> 1 + 2
08:48
<
jokke >
is the follwing somehow possible: define a macro that defines a method in a class, then stores somekind of function pointer to that method in a constant. Then at some point during runtime the instance of the class calls that function pointer.
08:49
<
jokke >
jhass: i've been trying to wrap my head around this for hours
08:49
<
jhass >
it needs to be a class method of course
08:49
<
jokke >
i need `self`
08:49
<
jhass >
which self? when you take the pointer there is none
08:49
<
jokke >
i guess i could pass it though
08:50
<
jhass >
you can't pass runtime values to macros
08:50
<
jokke >
but i can define a method which takes a runtime value through a macro
08:51
<
jhass >
yes, or a Proc
08:51
<
jhass >
->(obj : YourClass) { obj.{{name}} }
08:56
<
jokke >
if i pass a block to the macro, is there some possibility to define which name the variable passed to the proc will be?
08:56
<
jokke >
the block i pass to the macro should then be the body of the proc
08:56
<
jokke >
this won't work:
08:57
<
jokke >
that's exactly what i'm seeing
08:59
<
crystal-gh >
[crystal] ysbaddaden opened pull request #1492: Bcrypt: use Int32 for faster processing (master...std-bcrypt)
http://git.io/vZN9E
09:00
<
jokke >
jhass: but i
_must_ use the same variable name as in the macro definition, right?
09:00
<
jhass >
yes, please try to not rely on it
09:00
<
jhass >
it's more a bug that it works than anything else
09:01
<
jhass >
maybe you want the good old case when dispatcher?
09:01
<
jhass >
that is store the names of the methods you define with macros and then have a macro (method) that builds a case when dispatcher from that list
09:02
<
jokke >
i didn't think of that!
09:02
<
jokke >
yes that sounds a lot safer
09:03
<
jhass >
you can use a constant pointing to an array or hash for that
09:03
<
jhass >
or if you add a common prefix to your methods simply filter down @type.methods
09:14
dleedev has left #crystal-lang [#crystal-lang]
09:21
pawnbox_ has quit [Remote host closed the connection]
09:21
<
dzv >
jhass: #1489 why do you have a tuple of bytes and not an array or slice?
09:23
<
jhass >
I see no need to allocate heap memory there
09:33
Ven has quit [Ping timeout: 240 seconds]
09:42
tatey_ has joined #crystal-lang
10:06
<
crystal-gh >
[crystal] technorama opened pull request #1494: Add test vectors for Crypto::Bcrypt. (master...f/bcrypt_tests)
http://git.io/vZAUj
10:08
<
jokke >
jhass: can i somehow see the code that was generated after expanding all macros?
10:08
<
jhass >
jokke: to some extend with crystal browser
10:08
<
jokke >
crystal browser?
10:08
<
jhass >
or did we move that to tool now?
10:09
<
jhass >
apparently, so crystal tool browser
10:09
<
jhass >
also adding {{debug()}} to a macro definition prints its expansion up to that point to stdout
10:43
Ven has joined #crystal-lang
10:44
apt-get has joined #crystal-lang
10:48
Dreamer3 has quit [Quit: Leaving...]
10:50
<
jokke >
how do i return a void from a method?
10:50
<
jokke >
i just return nil
11:00
<
crystal-gh >
[crystal] jhass opened pull request #1495: Base64 for non-UTF8 (master...base64_decode)
http://git.io/vZAny
11:03
<
jokke >
jhass: do you see something wrong with this marcro?
11:04
<
jokke >
it doesn't seem to loop over the FIELDS
11:05
<
jhass >
maybe it's called before FIELDS is populated?
11:05
<
jokke >
no it's not
11:05
<
jokke >
i don't know
11:06
<
jokke >
the second file is what's using the macros
11:17
<
jhass >
sigh, right, sorry I was misleading I guess
11:19
<
jhass >
we gotta actually populate FIELDS at compile time
11:19
<
jhass >
currently you do it at runtime
11:20
<
jokke >
but it's getting populated from macros?
11:20
<
jokke >
isn't that compile time?
11:21
<
jhass >
you generate code in the macro that does
11:21
dyulax93 has quit [Quit: Saindo]
11:21
dyulax has quit [Quit: Saindo]
11:21
<
jhass >
only stuff inside {% %} and {{}} actually happens at compile time
11:22
<
jokke >
makes sense
11:22
<
jhass >
now there's HashLiteral#[]= and ArrayLiteral#<< even
11:22
<
jhass >
but I can't seem to access them from constants :/
11:23
<
jokke >
that's too bad
11:23
<
jhass >
ah, no just using the wrong macro syntax :P
11:23
nakilon has joined #crystal-lang
11:23
<
jhass >
{% FIELD_TYPES << type %}
11:23
<
jhass >
{% FIELDS[{{name}}] = [] of Symbol %}
11:23
<
jhass >
that should get you further
11:23
<
jokke >
cool thanks a lot
11:24
<
jokke >
this'd be really cool if it worked
11:24
<
jokke >
something like ActiveModel for crystal
11:25
<
jokke >
or at least a very crude version of it
11:28
<
jokke >
how can i use fresh variables inside {% %}
11:30
trapped has joined #crystal-lang
11:32
<
crystal-gh >
[crystal] waj closed pull request #1390: Add File#flock_* advisory locking methods to File. (master...f/flock)
http://git.io/vZvXO
11:32
<
jokke >
the %foo stuff
11:45
<
jhass >
just append the loop index or something?
11:46
Ven has quit [Read error: No route to host]
11:47
certainty has joined #crystal-lang
11:47
sadin has quit [Remote host closed the connection]
11:48
sadin has joined #crystal-lang
11:52
sadin has quit [Ping timeout: 250 seconds]
11:59
ssvb has quit [Ping timeout: 252 seconds]
12:03
<
jokke >
sorry i seem to be too stupid or something. i have no idea how to append anything in {% %}
12:03
<
jokke >
get unexpected token {{
12:03
<
jhass >
don't do {% {{foo}} %}
12:04
<
jhass >
{% already enters the macro scope, you can reference foo directly
12:04
<
jokke >
but if i need to concatenate?
12:04
<
jhass >
"bar_#{foo}".id ?
12:04
<
jokke >
didn't know i could do string interpolation in macro scope
12:16
<
jeromegn >
alright, so yesterday I realized that using StringIO would mangle my bytes... if I use a FileDescriptorIO, it's fine. However, it's much slower.
12:17
<
jeromegn >
isn't there a generic IO class I can use to write stuff to?
12:17
<
jhass >
IO.pipe? probably slower too
12:18
<
jhass >
We really really should turn StringIO into SliceIO
12:18
<
jeromegn >
SliceIO requires instantiation with a Slice of a specific size though
12:18
<
jeromegn >
well at least the implementation I was using
12:19
<
jeromegn >
IO.pipe returns a FileDescriptorIO :P
12:19
<
jeromegn >
I want a fast IO where I can write as many bytes as I like
12:19
<
jeromegn >
I mean, all of what I'm trying to do right now is going to be real practical for implementing specs that work with bytes
12:21
<
jeromegn >
I really feel like I'm missing some knowledge that'll make all this much easier. although you (jhass) did tell me my current implementation seemed alright
12:22
<
jhass >
well yeah, a proper SliceIO should probably reallocate in similar patterns as Array does
12:23
<
jeromegn >
interesting
12:23
<
jeromegn >
I feel like that would work with some minor adaptation
12:23
<
jeromegn >
I'll look at how the Array does it
12:25
Ven has joined #crystal-lang
12:44
<
jokke >
jhass: hm i really need to access the %var from {% %}
12:44
<
jokke >
i need unique method names which are added to a constant by the macro
12:44
<
jokke >
and i can't append any index to it
12:44
<
jokke >
because i don't have one
12:45
<
jokke >
the macro can be called multiple times with the same arguments (but different block)
12:48
<
jhass >
I don't think you can
12:48
<
jokke >
i can use size
12:48
lokulin has quit [Ping timeout: 246 seconds]
12:48
<
jokke >
but the string interpolation inside {% %} won't work
12:49
<
jokke >
it leaves the string as is
13:07
<
jeromegn >
I was under the impression this was discouraged
13:07
<
jeromegn >
assigning to a variable just to get the pointer
13:10
<
jhass >
jeromegn: you need to make sure to not hand that pointer out (as part of) the return value
13:10
<
jhass >
it should be fine to be gone when the method returns
13:10
lokulin has joined #crystal-lang
13:10
<
jeromegn >
sounds great
13:11
<
BlaXpirit >
yeah but it wouldn't hurt to allow pointer to the argument just as well >_>
13:11
<
BlaXpirit >
that and pointerof(self) are such silly limitations
13:15
<
jhass >
mmh, I guess so
13:17
ssvb has joined #crystal-lang
13:25
<
jeromegn >
well if we need to find ways to work around those, even in the standard lib, then I agree we should change it
13:26
<
jeromegn >
but I have no idea what the implications are :)
13:32
havenwood has joined #crystal-lang
13:33
<
asterite >
You can change that to pointerof(byte), I think that was from the time it didn't work for arguments
13:33
<
asterite >
however for `self` it will never work, because then you can change the value of self
13:34
<
emancu >
noob question: ruby has gems, what does crystal have similar to gems ?
13:34
sadin has joined #crystal-lang
13:34
<
emancu >
or using " github "stefanwille/crystal-redis" "
13:35
<
emancu >
is the only tool I need ?
13:36
<
emancu >
jeromegn: thanks!
13:36
<
emancu >
btw this lang is awesome =)
13:37
<
jeromegn >
it is! :)
13:37
<
emancu >
jeromegn: do you know if something similar to rack is in progress ?
13:40
<
jeromegn >
which are procs that accept a Request and return a Response
13:40
<
jeromegn >
I think the API for that is not ideal
13:41
<
emancu >
but the idea is to leave that code into crystal ?
13:41
<
emancu >
kind of weird
13:42
<
jeromegn >
the standard lib has too much in it IMO
13:42
<
emancu >
i just started yesterday, so i can't judge on that
13:42
<
emancu >
but i do believe that this HTTP server shouldn't belong to the stdlib
13:44
<
jeromegn >
I think the server is fine
13:44
<
jeromegn >
but the middleware handling and all
13:45
<
jeromegn >
not sure
13:45
<
jeromegn >
nothing stopping you from creating your own implementation of a http server :)
13:45
<
emancu >
but i'm wondering if i should start from scratch or just clone Rack and rename *.rb to *.cr
13:46
<
jeromegn >
haha, there's probably a lot that wouldn't work if you just did that
13:47
<
emancu >
only the [] and {} things
13:47
<
emancu >
yesterday I cloned 2 gems and did that
13:47
<
emancu >
i feel like a thief
13:47
<
emancu >
but it works
13:48
<
emancu >
didn't push
13:48
<
jeromegn >
also, which gems?
13:48
<
emancu >
just playing with crystal
13:48
<
emancu >
syro and Seg from soveran
13:48
<
emancu >
syro is like cuba
13:49
<
jeromegn >
those really simple gems though
13:51
<
emancu >
yes, im used to work with soveran's gems a lot..
13:51
<
emancu >
thats why I want to have the equivalents on crystal
13:51
<
emancu >
also because it will be easier for me to migrate from ruby existent projects to crystal
13:51
<
emancu >
and do some benchmarks ;)
13:52
<
jeromegn >
I'm doing a similar thing
13:52
<
jeromegn >
started with BSON
13:52
<
jeromegn >
(I work for compose.io)
13:53
<
emancu >
(i'm at citrusbyte.. and soveran used to work here :D )
13:53
<
emancu >
i saw that on the redis lib
13:53
<
jeromegn >
oh yea that thing is blazing
13:54
<
emancu >
jeromegn: im sorry but i need to leave right now
13:55
apt-get has quit [Quit: Quit]
13:55
apt-get has joined #crystal-lang
13:57
trapped has quit [Read error: Connection reset by peer]
14:01
waj has joined #crystal-lang
14:06
apt-get has quit [Quit: Quit]
14:06
apt-get has joined #crystal-lang
14:09
apt-get_ has joined #crystal-lang
14:10
apt-get has quit [Ping timeout: 240 seconds]
14:12
<
BlaXpirit >
asterite, so what if u can change the value of `self`?
14:13
<
BlaXpirit >
you can change a lot of things like that, why is self special?
14:13
<
BlaXpirit >
it's unsafe code...
14:14
<
crystal-gh >
[crystal] jhass opened pull request #1498: Improve HTTP::Cookies (master...cookie_sync)
http://git.io/vZxcF
14:15
<
waj >
BlaXpirit: is there a use case for that?
14:15
<
BlaXpirit >
yeah, the use case is another thing that has been in avoidance
14:16
<
BlaXpirit >
using C structs directly in code. very little needs to be done to make it viable. making wrappers of disposable structs is NOT viable
14:22
<
waj >
in that code are you passing a pointer to the crystal struct?
14:22
<
BlaXpirit >
waj, i'm passing a pointer to a C/lib struct
14:22
<
BlaXpirit >
i'm reopening a C struct here
14:24
<
BlaXpirit >
everything is great except for the unability to define my own `initialize`/`new` and taking the pointer of self
14:26
<
BlaXpirit >
and what jeromegn linked - instead of an argument, `self` could be needed in just the same situation
14:28
<
crystal-gh >
[crystal] tebakane opened pull request #1499: Add `Array#select`, `Array#reject` and some description. (master...add_select_reject)
http://git.io/vZxBl
14:28
<
jokke >
jhass: was it so that one can't check if a block was passed to a macro?
14:30
<
jhass >
jokke: I linked you a way
14:32
<
jokke >
i'll try to find it in the backlog
14:35
<
BlaXpirit >
how does it work without a block then?
14:36
<
BlaXpirit >
why doesnt it complain that no block was passed?
14:37
<
asterite >
BlaXpirit: because you can do `record Foo, x, y` and `record Foo x, y { ... }`. Since macros are interpreted we can do things in a much more lax way
14:38
<
jhass >
waj: asterite I still see the following potential renames, but I'm less sure about them, could you shoot you gut feelings for each? CharReader -> Char::Reader PointerIO -> Pointer::IO PointerAppender -> Pointer::Appender StringIO -> String::IO
14:39
<
jhass >
BlaXpirit: you could picture it like Ruby's block arg, it's always implicitly there, but if none is given it's nil. Then {{yield}} is sort of like interpolation and "#{nil}" -> ""
14:40
<
jhass >
jeromegn: that nil is coming from puts
14:40
<
jeromegn >
oops, that's right
14:41
<
jeromegn >
:facepalm:
14:41
ylluminate has quit [Ping timeout: 265 seconds]
14:42
<
Netfeed >
jeromegn: nice additions
14:42
<
Netfeed >
sorry, jhass
14:43
<
jeromegn >
that makes more sense ;)
14:44
ylluminate has joined #crystal-lang
14:54
<
jhass >
I have not the slightest idea
15:01
ylluminate has quit [Ping timeout: 246 seconds]
15:05
<
jokke >
it comes from a totally different part of the code
15:05
waj has quit [Ping timeout: 240 seconds]
15:05
waj has joined #crystal-lang
15:08
<
crystal-gh >
[crystal] kirbyfan64 opened pull request #1500: More JSON error messages (DON'T MERGE YET!!) (master...json_err)
http://git.io/vZxPH
15:19
Excureo has quit [Remote host closed the connection]
15:20
<
crystal-gh >
[crystal] kirbyfan64 opened pull request #1501: Add symbolize (master...symbolize)
http://git.io/vZxyW
15:30
waj has quit [Read error: Connection reset by peer]
15:30
waj has joined #crystal-lang
15:39
benner has quit [Read error: Connection reset by peer]
15:39
benner has joined #crystal-lang
15:40
Excureo has joined #crystal-lang
15:41
waj has quit [Remote host closed the connection]
15:50
Neverdie has joined #crystal-lang
15:51
juancate_ is now known as juancate
15:51
juancate has quit [Changing host]
15:51
juancate has joined #crystal-lang
15:59
ylluminate has joined #crystal-lang
16:09
havenwood has joined #crystal-lang
16:15
ylluminate has quit [Ping timeout: 246 seconds]
16:18
dfockler has joined #crystal-lang
16:20
waj has joined #crystal-lang
16:26
shama has joined #crystal-lang
16:28
<
crystal-gh >
crystal/master f4d511b Ryan Gonzalez: More JSON error messages
16:28
<
crystal-gh >
crystal/master f27ca86 Ryan Gonzalez: Even more JSON error messages
16:28
<
crystal-gh >
crystal/master c9c28b9 Ary Borenszweig: Merge pull request #1500 from kirbyfan64/json_err...
16:33
Neverdie has joined #crystal-lang
16:36
Ven has quit [Ping timeout: 272 seconds]
16:46
<
crystal-gh >
crystal/master 71b032f Ary Borenszweig: Refactored command to create an instance of it so we can share some state and the logic is simpler
16:47
dyulax has joined #crystal-lang
16:50
dyulax has quit [Client Quit]
16:51
waj has quit [Ping timeout: 240 seconds]
16:51
dyulax has joined #crystal-lang
16:51
waj has joined #crystal-lang
16:54
elia has quit [Quit: Computer has gone to sleep.]
16:55
kulelu88 has joined #crystal-lang
16:56
waj has quit [Ping timeout: 244 seconds]
16:56
waj has joined #crystal-lang
16:58
<
crystal-gh >
crystal/master 698cca6 Jonne Haß: Rename Base64.decode to Base64.decode_string, add Base64.decode...
16:58
<
crystal-gh >
crystal/master d200da9 Ary Borenszweig: Merge pull request #1495 from jhass/base64_decode...
17:00
<
crystal-gh >
crystal/master 6086f5d Tim Hagemann: Added convenience method to open a websocket to a server.
17:00
<
crystal-gh >
crystal/master 5f08cb1 Ary Borenszweig: Merge pull request #1369 from kumpelblase2/patch-1...
17:01
qard has joined #crystal-lang
17:04
<
crystal-gh >
crystal/master afad43e Ary Borenszweig: Added WebSokcet.open(String). Related to #1369
17:05
<
crystal-gh >
crystal/master 11500dc tebasaki: Add `Array#select!` and `Array#reject!` descriptions.
17:05
<
crystal-gh >
crystal/master 0faf94c Jonne Haß: Merge pull request #1499 from tebakane/add_select_reject...
17:08
<
crystal-gh >
crystal/master e6a69f4 Ary Borenszweig: Merge pull request #1319 from technorama/f/socket_options...
17:08
<
crystal-gh >
crystal/master 3816b22 Technorama Ltd: Add Socket option helper methods....
17:12
sadin has quit [Remote host closed the connection]
17:17
<
dzv >
is it possible to use LibC.printf "#{object_id}" in Object.finalize? getting compiler errors
17:19
vegai has left #crystal-lang [#crystal-lang]
17:36
waj has quit [Ping timeout: 246 seconds]
17:37
waj has joined #crystal-lang
17:39
<
BlaXpirit >
dzv, strange.. that's all i can say
17:47
<
crystal-gh >
[crystal] asterite closed pull request #1452: Allow comparison between different Iterable types. (master...f/slice_compare)
http://git.io/vZVZf
17:48
<
dzv >
is the string in puts("foo") heap allocated per call or single allocated?
17:51
<
jhass >
it should be embedded into the data section of the binary
17:51
thor77 has joined #crystal-lang
17:51
<
thor77 >
is there a macro for getter + setter?
17:52
<
thor77 >
ah, thanks :)
17:52
<
thor77 >
(some documentation on build-in macros would be nice)
17:54
<
crystal-gh >
crystal/master bd5fc72 Ary Borenszweig: Fixed #1476: wrong behaviour for union of classes that include abstract classes like Int
17:58
havenwood has joined #crystal-lang
17:58
<
crystal-gh >
[crystal] asterite closed pull request #1498: Improve HTTP::Cookies (master...cookie_sync)
http://git.io/vZxcF
18:01
waj has quit [Ping timeout: 250 seconds]
18:02
waj has joined #crystal-lang
18:09
havenwood has quit [Ping timeout: 250 seconds]
18:10
havenwood has joined #crystal-lang
18:12
ylluminate has joined #crystal-lang
18:36
havenwood has quit [Ping timeout: 246 seconds]
18:40
bougyman has quit [Ping timeout: 256 seconds]
18:41
waj has quit [Ping timeout: 264 seconds]
18:44
havenwood has joined #crystal-lang
18:47
dfockler has quit [Remote host closed the connection]
18:48
waj has joined #crystal-lang
18:51
waj has quit [Read error: Connection reset by peer]
18:51
waj has joined #crystal-lang
18:57
<
crystal-gh >
crystal/master 3206f67 Ary Borenszweig: Set a fixed type for string interpolations
18:57
<
crystal-gh >
crystal/master f2a5ebf Ary Borenszweig: Marking an `initialize` as private makes the autogenerated `new` method private
19:12
havenwood has quit [Ping timeout: 265 seconds]
19:15
elia has joined #crystal-lang
19:16
waj has quit [Read error: Connection reset by peer]
19:16
dfockler has joined #crystal-lang
19:17
waj has joined #crystal-lang
19:35
bougyman has joined #crystal-lang
19:36
apt-get has joined #crystal-lang
19:36
<
dzv >
what does this mean and how do i avoid it? "can't use class variable with generic types, only with generic types instances".
http://carc.in/#/r/fno
19:37
apt-get_ has quit [Ping timeout: 246 seconds]
19:39
elia has quit [Quit: Computer has gone to sleep.]
19:41
dfockler has quit [Remote host closed the connection]
19:43
havenwood has joined #crystal-lang
19:48
<
asterite >
we didn't take a decision about what @@list represents there. Is it one for all instances or one for each instance?
19:48
<
asterite >
Or.. what do you want to do?
19:57
waj_ has joined #crystal-lang
19:59
havenn has joined #crystal-lang
19:59
waj has quit [Ping timeout: 240 seconds]
20:02
havenwood has quit [Ping timeout: 244 seconds]
20:06
waj_ is now known as waj
20:11
<
crystal-gh >
crystal/master 5f39286 Ary Borenszweig: Some simplifications in the parser and other location-related places
20:11
<
crystal-gh >
crystal/master 16202e0 Ary Borenszweig: Removed a duplicated spec and fixed some typos
20:17
waj has quit [Ping timeout: 260 seconds]
20:18
waj has joined #crystal-lang
20:32
dyulax has quit [Quit: Saindo]
20:34
ylluminate has quit [Read error: Connection reset by peer]
20:35
ylluminate has joined #crystal-lang
20:36
dfockler has joined #crystal-lang
20:38
ssvb has quit [Ping timeout: 246 seconds]
20:51
ssvb has joined #crystal-lang
21:00
dleedev has joined #crystal-lang
21:01
<
dleedev >
are Threads supported in crystal?
21:01
<
dleedev >
I couldn’t find documentation anywhere regarding threads
21:02
<
BlaXpirit >
dleedev, you can make threads but it is not supported
21:02
<
BlaXpirit >
they break things
21:02
<
BlaXpirit >
the alternative is fibers
21:03
apt-get has quit [Read error: Connection reset by peer]
21:03
<
dleedev >
fibers in crystal support concurrency, but not parallelism, right?
21:03
<
dleedev >
how can I take advantage of multiple processor cores
21:04
apt-get has joined #crystal-lang
21:05
<
BlaXpirit >
dleedev, i guess you could use threads if you're very careful
21:05
<
BlaXpirit >
in the future fibers may run in a thread pool
21:05
<
BlaXpirit >
but now they're in one thread, yes
21:06
<
dleedev >
just saw this comment:
21:06
<
dleedev >
# Use spawn and channels instead.
21:06
<
BlaXpirit >
dleedev, that's fibers
21:07
<
BlaXpirit >
there are no synchronization primitives or communication methods
21:07
<
BlaXpirit >
for threads
21:07
<
dleedev >
so no mutexes?
21:07
<
BlaXpirit >
dleedev, u can get these things from some C lib
21:07
<
BlaXpirit >
oh so there are, i didnt know
21:08
<
dleedev >
fibers across thread pools sounds interesting
21:10
<
BlaXpirit >
dleedev, there aren't any threadsafe data structures , and I/O breaks
21:10
<
dleedev >
:(, so threads basically are a no-go?
21:11
<
dleedev >
I’m guessing implementation in crystal is not reentrant?
21:11
<
BlaXpirit >
if you use threads just for computations and use UNIX pipes to give input and get output, then this seems ok
21:12
<
dleedev >
what if each thread holds its own local variables and all shared data or IO happens inside a mutex?
21:13
<
BlaXpirit >
i think IO must happen in main thread
21:15
<
crystal-gh >
[crystal] andywenk opened pull request #1503: Fix the occurences of hierarchy in the docs (gh-pages...fix_hierarchy_command_in_docs)
http://git.io/vZhdg
21:15
<
BlaXpirit >
hm a threadpooled 'map' seems like a fun project
21:15
<
dleedev >
is there a list of TODOS until 1.0?
21:17
<
dleedev >
I’m wondering if thread safety is in that list
21:18
<
crystal-gh >
[crystal] jhass closed pull request #1503: Fix the occurences of hierarchy in the docs (gh-pages...fix_hierarchy_command_in_docs)
http://git.io/vZhdg
21:19
<
DeBot >
jhass: Nothing known about roadmap.
21:19
<
DeBot >
jhass: Set roadmap.
21:20
<
dleedev >
ah, thanks
21:20
dfockler has left #crystal-lang [#crystal-lang]
21:23
ssvb has quit [Ping timeout: 252 seconds]
21:25
ssvb has joined #crystal-lang
21:33
<
dzv >
threads won't work with the io system, or the gc. so no threads
21:39
<
BlaXpirit >
not crazy at all, in my opinion :p
21:41
elia has joined #crystal-lang
21:41
havenn has quit [Ping timeout: 240 seconds]
21:44
<
jhass >
well it loops forever so you never ran it :P
21:44
<
jhass >
oh, nvm I read the assignment backwards
21:45
<
jhass >
all that locking will make it slow though
21:45
<
jhass >
probably better to shard the work
21:46
<
BlaXpirit >
well sure, there are better implementations, but it's something
21:46
<
jhass >
eg spawn a thread for each cpu and let it handle (i % n) == thread_number
21:46
ssvb has quit [Ping timeout: 240 seconds]
21:46
<
BlaXpirit >
then some threads will finish before others
21:47
<
jhass >
which doesn't have to be bad, especially with uniform workloads
21:47
ssvb has joined #crystal-lang
21:47
<
BlaXpirit >
the only simple thing i can think of is letting threads to N tasks at a time instead of 1
21:48
<
jhass >
requires synchronization too though
21:48
<
BlaXpirit >
sure, but N times faster :p
21:48
<
jhass >
which for many workloads will probably outweight some idle time
21:49
fowlduck has joined #crystal-lang
21:54
nakilon has quit [Ping timeout: 244 seconds]
21:55
ssvb has quit [Ping timeout: 252 seconds]
22:00
<
BlaXpirit >
about 3 times speed increase is pretty good anyway
22:00
elia has quit [Quit: Computer has gone to sleep.]
22:01
<
BlaXpirit >
dleedev, the code i linked might be interesting to you
22:05
apt-get has quit [Remote host closed the connection]
22:06
pawnbox has joined #crystal-lang
22:06
pawnbox has quit [Remote host closed the connection]
22:07
<
dleedev >
I wonder if it could be made to support lazy map
22:08
ssvb has joined #crystal-lang
22:08
<
dleedev >
basically, stream of input -> stream of output
22:08
<
BlaXpirit >
dleedev, sure it can. python does it
22:08
<
BlaXpirit >
i just made something quick
22:21
havenwood has joined #crystal-lang
22:26
<
BlaXpirit >
welp, this chunking seems to have little effect
22:32
waj has quit [Ping timeout: 240 seconds]
22:32
waj has joined #crystal-lang
22:33
havenwood has quit [Ping timeout: 246 seconds]
22:34
nakilon has joined #crystal-lang
22:37
elia has joined #crystal-lang
22:37
waj has quit [Ping timeout: 250 seconds]
22:38
waj has joined #crystal-lang
22:38
<
BlaXpirit >
aha, it does help immensely when there are tons of very very quick operations
22:39
nakilon has quit [Ping timeout: 246 seconds]
22:49
dleedev has quit [Quit: dleedev]
22:50
elia has quit [Quit: Computer has gone to sleep.]
22:54
nakilon has joined #crystal-lang
22:54
ssvb has quit [Ping timeout: 250 seconds]
22:59
nakilon has quit [Ping timeout: 260 seconds]
23:06
BlaXpirit has quit [Quit: Konversation]
23:07
ssvb has joined #crystal-lang
23:10
dleedev has joined #crystal-lang
23:11
fowlduck has quit [Quit: Leaving...]
23:13
waj has quit [Remote host closed the connection]
23:39
dleedev has quit [Read error: Connection reset by peer]
23:42
ylluminate has quit [Ping timeout: 240 seconds]
23:48
<
crystal-gh >
[crystal] waterlink opened pull request #1505: Add `HTTP::Request#query_params` (master...http/add-query-and-body-params)
http://git.io/vZj0L
23:57
<
dzv >
jhass: #1489 wouldn't a StaticArray satisfy your nonheap memory goal?