jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.7 | 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
vikaton has joined #crystal-lang
jokke1 is now known as jokke
<jokke> hi
<jokke> how can i use "self" in macros?
<jokke> i have a macro like the following
<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
<DeBot> jokke: Syntax error in eval:13: expecting identifier 'end', not 'EOF' - http://carc.in/#/r/fkg
<jokke> no way..
<jokke> this works
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
<jokke> well
<jokke> my use case is slightly different
grindhold_ has joined #crystal-lang
grindhold has quit [Quit: No Ping reply in 180 seconds.]
juancate_ has joined #crystal-lang
qard has joined #crystal-lang
jhass has quit [*.net *.split]
asie has quit [*.net *.split]
juancate has quit [*.net *.split]
Kilo`byte has quit [*.net *.split]
jhass|off has joined #crystal-lang
Kilo`byte has joined #crystal-lang
jhass|off is now known as jhass
asie has joined #crystal-lang
Neverdie has joined #crystal-lang
jsaak has quit [Ping timeout: 246 seconds]
jsaak has joined #crystal-lang
CraigBuchek has joined #crystal-lang
<jeromegn> :)
nakilon has joined #crystal-lang
nakilon has quit [Ping timeout: 250 seconds]
jsaak has quit [Ping timeout: 246 seconds]
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jsaak has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has quit [Max SendQ exceeded]
havenwood has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
sadin has joined #crystal-lang
asie has quit [*.net *.split]
asie has joined #crystal-lang
CraigBuchek has quit [Quit: Leaving.]
emancu has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
nakilon has joined #crystal-lang
nakilon has quit [Ping timeout: 260 seconds]
<emancu> Hello! does anybody knows if exist an implementation of Ruby's rack lib in Crystal ?
Neverdie has quit [Quit: http://radiux.io/]
pawnbox_ has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
trapped has joined #crystal-lang
havenwood has quit [Remote host closed the connection]
konsolebox has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
konsolebox has left #crystal-lang ["Leaving"]
<dzv> server = Server.new(8080) { |req| HTTP::Response.ok("text/plain", "OK") }
<dzv> it's not exactly rack but it's easy to use. see spec/std/http/server_spec.cr for examples.
<crystal-gh> [crystal] technorama opened pull request #1491: fork returns a Process. Small resource leak fixed. (master...f/fork_process) http://git.io/vZNYd
dyulax93 has quit [Read error: Connection reset by peer]
dyulax93 has joined #crystal-lang
dyulax has quit [Read error: Connection reset by peer]
dyulax has joined #crystal-lang
pawnbox has joined #crystal-lang
<pawnbox> Just a small question.
<pawnbox> What the rationale behind No autosplat?
nakilon has joined #crystal-lang
pawnbox has quit [Ping timeout: 255 seconds]
pawnbox_ has joined #crystal-lang
elia has joined #crystal-lang
nakilon has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden pushed 2 new commits to master: http://git.io/vZN2y
<crystal-gh> crystal/master e13fe25 Victor Bergoo: HTTP Cookie handling
<crystal-gh> crystal/master e94e7f8 Julien Portalier: Merge pull request #1252 from netfeed/http_cookie...
<Netfeed> \o/
<crystal-gh> [crystal] jhass closed pull request #1470: Add Number.clamp. (master...f/range_clamp) http://git.io/vZM0U
elia has quit [Read error: Connection reset by peer]
elia has joined #crystal-lang
BlaXpirit has joined #crystal-lang
<travis-ci> manastech/crystal#e94e7f8 (master - Merge pull request #1252 from netfeed/http_cookie): The build was broken. https://travis-ci.org/manastech/crystal/builds/80589210
<travis-ci> manastech/crystal#1375981 (master - Merge pull request #1470 from technorama/f/range_clamp): The build passed. https://travis-ci.org/manastech/crystal/builds/80589746
<Netfeed> oh, come on!
<Netfeed> that doesn't look like my fault
<jhass> Netfeed: no that seems like a random bug
<Netfeed> good, well, not good, but good for me
<pawnbox_> >> 1 + 2
<DeBot> pawnbox_: # => 3 - http://carc.in/#/r/flk
<jokke> hello
<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.
<jhass> yes
<jokke> jhass: i've been trying to wrap my head around this for hours
<jhass> it needs to be a class method of course
<jokke> aaah
<jokke> no
<jokke> won't do
<jokke> i need `self`
<jhass> which self? when you take the pointer there is none
<jokke> mmh
<jokke> i guess i could pass it though
<jhass> you can't pass runtime values to macros
<jokke> but i can define a method which takes a runtime value through a macro
<jhass> yes, or a Proc
<jokke> yeah
<jhass> ->(obj : YourClass) { obj.{{name}} }
<jokke> hmm
<jokke> weird
<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?
<jokke> the block i pass to the macro should then be the body of the proc
<jokke> this won't work:
<jokke> ah yes
<jokke> that's exactly what i'm seeing
<jokke> ah
<jokke> ok
<crystal-gh> [crystal] ysbaddaden opened pull request #1492: Bcrypt: use Int32 for faster processing (master...std-bcrypt) http://git.io/vZN9E
<jokke> jhass: but i _must_ use the same variable name as in the macro definition, right?
<jhass> yes, please try to not rely on it
<jhass> it's more a bug that it works than anything else
<jokke> :/
<jhass> maybe you want the good old case when dispatcher?
<jokke> hm?
<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
<jokke> oooh
<jokke> ooooooh
<jokke> i didn't think of that!
<jokke> yes that sounds a lot safer
<jhass> you can use a constant pointing to an array or hash for that
<jhass> or if you add a common prefix to your methods simply filter down @type.methods
dleedev has left #crystal-lang [#crystal-lang]
pawnbox_ has quit [Remote host closed the connection]
<dzv> jhass: #1489 why do you have a tuple of bytes and not an array or slice?
<jhass> I see no need to allocate heap memory there
Ven has quit [Ping timeout: 240 seconds]
tatey_ has joined #crystal-lang
<crystal-gh> [crystal] technorama opened pull request #1494: Add test vectors for Crypto::Bcrypt. (master...f/bcrypt_tests) http://git.io/vZAUj
<jokke> jhass: can i somehow see the code that was generated after expanding all macros?
<jhass> jokke: to some extend with crystal browser
<jokke> crystal browser?
<jhass> yes
<jhass> or did we move that to tool now?
<jhass> apparently, so crystal tool browser
<jhass> also adding {{debug()}} to a macro definition prints its expansion up to that point to stdout
<jokke> ok
Ven has joined #crystal-lang
apt-get has joined #crystal-lang
Dreamer3 has quit [Quit: Leaving...]
<jokke> how do i return a void from a method?
<jokke> never mind
<jokke> i just return nil
<crystal-gh> [crystal] jhass opened pull request #1495: Base64 for non-UTF8 (master...base64_decode) http://git.io/vZAny
<jokke> hmm
<jokke> ok
<jokke> jhass: do you see something wrong with this marcro?
<jokke> it doesn't seem to loop over the FIELDS
<jhass> maybe it's called before FIELDS is populated?
<jokke> no it's not
<jokke> or
<jokke> i don't know
<jokke> the second file is what's using the macros
<jhass> mmh
<jhass> sigh, right, sorry I was misleading I guess
<jokke> :/
<jhass> we gotta actually populate FIELDS at compile time
<jhass> currently you do it at runtime
<jokke> i do?
<jokke> but it's getting populated from macros?
<jokke> isn't that compile time?
<jhass> you generate code in the macro that does
<jhass> it
dyulax93 has quit [Quit: Saindo]
dyulax has quit [Quit: Saindo]
<jokke> yes
<jhass> only stuff inside {% %} and {{}} actually happens at compile time
<jokke> ah
<jokke> ah ok
<jokke> sure
<jokke> makes sense
<jhass> now there's HashLiteral#[]= and ArrayLiteral#<< even
<jokke> oh cool
<jhass> but I can't seem to access them from constants :/
<jokke> oh :/
<jokke> that's too bad
<jhass> ah, no just using the wrong macro syntax :P
nakilon has joined #crystal-lang
<jhass> {% FIELD_TYPES << type %}
<jokke> oh?
<jhass> {% FIELDS[{{name}}] = [] of Symbol %}
<jhass> that should get you further
<jokke> cool thanks a lot
<jokke> this'd be really cool if it worked
<jokke> something like ActiveModel for crystal
<jokke> or at least a very crude version of it
<jokke> hmm
<jokke> how can i use fresh variables inside {% %}
trapped has joined #crystal-lang
<crystal-gh> [crystal] waj closed pull request #1390: Add File#flock_* advisory locking methods to File. (master...f/flock) http://git.io/vZvXO
<jhass> jokke: mh?
<jokke> the %foo stuff
<travis-ci> manastech/crystal#089c87d (master - Merge pull request #1390 from technorama/f/flock): The build passed. https://travis-ci.org/manastech/crystal/builds/80616932
<jhass> just append the loop index or something?
Ven has quit [Read error: No route to host]
certainty has joined #crystal-lang
sadin has quit [Remote host closed the connection]
sadin has joined #crystal-lang
sadin has quit [Ping timeout: 250 seconds]
ssvb has quit [Ping timeout: 252 seconds]
<jokke> sorry i seem to be too stupid or something. i have no idea how to append anything in {% %}
<jokke> get unexpected token {{
<jhass> don't do {% {{foo}} %}
<jokke> hm
<jokke> what then?
<jhass> {% already enters the macro scope, you can reference foo directly
<jokke> but if i need to concatenate?
<jokke> bar_foo
<jhass> "bar_#{foo}".id ?
<jokke> aah
<jokke> didn't know i could do string interpolation in macro scope
<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.
<jeromegn> isn't there a generic IO class I can use to write stuff to?
<jhass> IO.pipe? probably slower too
<jhass> We really really should turn StringIO into SliceIO
<jeromegn> SliceIO requires instantiation with a Slice of a specific size though
<jeromegn> well at least the implementation I was using
<jeromegn> IO.pipe returns a FileDescriptorIO :P
<jeromegn> I want a fast IO where I can write as many bytes as I like
<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
<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
<jhass> well yeah, a proper SliceIO should probably reallocate in similar patterns as Array does
<jeromegn> interesting
<jeromegn> I feel like that would work with some minor adaptation
<jeromegn> I'll look at how the Array does it
Ven has joined #crystal-lang
<jokke> jhass: hm i really need to access the %var from {% %}
tatey_ has quit []
<jokke> i need unique method names which are added to a constant by the macro
<jokke> and i can't append any index to it
<jokke> because i don't have one
<jokke> this one
<jokke> the macro can be called multiple times with the same arguments (but different block)
<jhass> I don't think you can
<jokke> ok
<jokke> no matter
<jokke> i can use size
lokulin has quit [Ping timeout: 246 seconds]
<jokke> but the string interpolation inside {% %} won't work
<jokke> it leaves the string as is
<jeromegn> ah!
<jeromegn> I was under the impression this was discouraged
<jeromegn> assigning to a variable just to get the pointer
<jhass> jeromegn: you need to make sure to not hand that pointer out (as part of) the return value
<jeromegn> :+1:
<jhass> it should be fine to be gone when the method returns
lokulin has joined #crystal-lang
<jeromegn> sounds great
<BlaXpirit> yeah but it wouldn't hurt to allow pointer to the argument just as well >_>
<BlaXpirit> that and pointerof(self) are such silly limitations
<jhass> mmh, I guess so
ssvb has joined #crystal-lang
<jeromegn> well if we need to find ways to work around those, even in the standard lib, then I agree we should change it
<jeromegn> but I have no idea what the implications are :)
havenwood has joined #crystal-lang
<asterite> You can change that to pointerof(byte), I think that was from the time it didn't work for arguments
<asterite> however for `self` it will never work, because then you can change the value of self
<emancu> noob question: ruby has gems, what does crystal have similar to gems ?
sadin has joined #crystal-lang
<emancu> or using " github "stefanwille/crystal-redis" "
<emancu> is the only tool I need ?
<jeromegn> emancu: for now that's all there is. there's the concept of "Shards" which is a work in progress: https://github.com/ysbaddaden/shards
<emancu> jeromegn: thanks!
<emancu> btw this lang is awesome =)
<jeromegn> it is! :)
<emancu> jeromegn: do you know if something similar to rack is in progress ?
<jeromegn> emancu: well, I think there were talks about it. but technically there's something similar built into Crystal. https://github.com/manastech/crystal/blob/master/src/http/server/server.cr
<jeromegn> I mean
<jeromegn> which are procs that accept a Request and return a Response
<jeromegn> I think the API for that is not ideal
<emancu> but the idea is to leave that code into crystal ?
<emancu> kind of weird
<jeromegn> the standard lib has too much in it IMO
<emancu> i just started yesterday, so i can't judge on that
<emancu> but i do believe that this HTTP server shouldn't belong to the stdlib
<jeromegn> I think the server is fine
<jeromegn> but the middleware handling and all
<jeromegn> not sure
<jeromegn> nothing stopping you from creating your own implementation of a http server :)
<emancu> i know
<emancu> but i'm wondering if i should start from scratch or just clone Rack and rename *.rb to *.cr
<emancu> xD
<jeromegn> haha, there's probably a lot that wouldn't work if you just did that
<emancu> only the [] and {} things
<emancu> yesterday I cloned 2 gems and did that
<emancu> i feel like a thief
<emancu> but it works
<jeromegn> heh
<jeromegn> link?
<emancu> didn't push
<jeromegn> also, which gems?
<emancu> just playing with crystal
<emancu> syro and Seg from soveran
<emancu> syro is like cuba
<jeromegn> those really simple gems though
<jeromegn> there are some Crystal equivalent (sometimes) https://github.com/search?utf8=%E2%9C%93&q=language%3ACrystal+router
<emancu> yes, im used to work with soveran's gems a lot..
<emancu> thats why I want to have the equivalents on crystal
<emancu> also because it will be easier for me to migrate from ruby existent projects to crystal
<jeromegn> indeed
<emancu> and do some benchmarks ;)
<jeromegn> I'm doing a similar thing
<jeromegn> started with BSON
<jeromegn> (I work for compose.io)
<emancu> awesome
<jeromegn> benchmarks are promising: https://github.com/jeromegn/bson.cr/tree/master/perf
<emancu> (i'm at citrusbyte.. and soveran used to work here :D )
<emancu> i saw that on the redis lib
<jeromegn> oh yea that thing is blazing
<emancu> jeromegn: im sorry but i need to leave right now
<emancu> ttyl!
apt-get has quit [Quit: Quit]
apt-get has joined #crystal-lang
<jeromegn> alright
trapped has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
apt-get has quit [Quit: Quit]
apt-get has joined #crystal-lang
apt-get_ has joined #crystal-lang
apt-get has quit [Ping timeout: 240 seconds]
<BlaXpirit> asterite, so what if u can change the value of `self`?
<BlaXpirit> you can change a lot of things like that, why is self special?
<BlaXpirit> it's unsafe code...
<crystal-gh> [crystal] jhass opened pull request #1498: Improve HTTP::Cookies (master...cookie_sync) http://git.io/vZxcF
<waj> BlaXpirit: is there a use case for that?
<BlaXpirit> yeah, the use case is another thing that has been in avoidance
<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
<waj> in that code are you passing a pointer to the crystal struct?
<BlaXpirit> waj, i'm passing a pointer to a C/lib struct
<BlaXpirit> i'm reopening a C struct here
<BlaXpirit> everything is great except for the unability to define my own `initialize`/`new` and taking the pointer of self
<BlaXpirit> and what jeromegn linked - instead of an argument, `self` could be needed in just the same situation
<crystal-gh> [crystal] tebakane opened pull request #1499: Add `Array#select`, `Array#reject` and some description. (master...add_select_reject) http://git.io/vZxBl
<jokke> jhass: was it so that one can't check if a block was passed to a macro?
<jhass> jokke: I linked you a way
<jokke> you did?
<jokke> hm
<jokke> i'll try to find it in the backlog
<jhass> jokke: http://carc.in/#/r/fn1
<jokke> oh thanks
<jokke> hmm
<jokke> ah
<jokke> yeah
<jokke> perfect
<BlaXpirit> how does it work without a block then?
<BlaXpirit> why doesnt it complain that no block was passed?
<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
<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
<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}" -> ""
<jeromegn> it does indeed return nil: http://carc.in/#/r/fn3
<jhass> jeromegn: that nil is coming from puts
<jeromegn> oh
<jeromegn> oops, that's right
<jeromegn> :facepalm:
ylluminate has quit [Ping timeout: 265 seconds]
<Netfeed> jeromegn: nice additions
<Netfeed> sorry, jhass
<jeromegn> that makes more sense ;)
ylluminate has joined #crystal-lang
<jokke> what does this mean? https://p.jreinert.com/YnC/
<jhass> I have not the slightest idea
<jokke> :/
<jokke> the macro before expansion looks like this: https://p.jreinert.com/PyJ3qd/ruby
ylluminate has quit [Ping timeout: 246 seconds]
<jokke> ok
<jokke> it comes from a totally different part of the code
waj has quit [Ping timeout: 240 seconds]
waj has joined #crystal-lang
<crystal-gh> [crystal] kirbyfan64 opened pull request #1500: More JSON error messages (DON'T MERGE YET!!) (master...json_err) http://git.io/vZxPH
Excureo has quit [Remote host closed the connection]
<crystal-gh> [crystal] kirbyfan64 opened pull request #1501: Add symbolize (master...symbolize) http://git.io/vZxyW
waj has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
benner has quit [Read error: Connection reset by peer]
benner has joined #crystal-lang
Excureo has joined #crystal-lang
waj has quit [Remote host closed the connection]
Neverdie has joined #crystal-lang
juancate_ is now known as juancate
juancate has quit [Changing host]
juancate has joined #crystal-lang
ylluminate has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
havenwood has joined #crystal-lang
ylluminate has quit [Ping timeout: 246 seconds]
dfockler has joined #crystal-lang
waj has joined #crystal-lang
Neverdie has quit [Quit: http://radiux.io/]
shama has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vZptL
<crystal-gh> crystal/master f4d511b Ryan Gonzalez: More JSON error messages
<crystal-gh> crystal/master f27ca86 Ryan Gonzalez: Even more JSON error messages
<crystal-gh> crystal/master c9c28b9 Ary Borenszweig: Merge pull request #1500 from kirbyfan64/json_err...
Neverdie has joined #crystal-lang
Ven has quit [Ping timeout: 272 seconds]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<travis-ci> manastech/crystal#c9c28b9 (master - Merge pull request #1500 from kirbyfan64/json_err): The build passed. https://travis-ci.org/manastech/crystal/builds/80670938
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZp4o
<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
dyulax has joined #crystal-lang
dyulax has quit [Client Quit]
waj has quit [Ping timeout: 240 seconds]
dyulax has joined #crystal-lang
waj has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
kulelu88 has joined #crystal-lang
waj has quit [Ping timeout: 244 seconds]
waj has joined #crystal-lang
<travis-ci> manastech/crystal#71b032f (master - Refactored command to create an instance of it so we can share some state and the logic is simpler): The build passed. https://travis-ci.org/manastech/crystal/builds/80673803
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vZpE0
<crystal-gh> crystal/master 698cca6 Jonne Haß: Rename Base64.decode to Base64.decode_string, add Base64.decode...
<crystal-gh> crystal/master d200da9 Ary Borenszweig: Merge pull request #1495 from jhass/base64_decode...
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vZpuG
<crystal-gh> crystal/master 6086f5d Tim Hagemann: Added convenience method to open a websocket to a server.
<crystal-gh> crystal/master 5f08cb1 Ary Borenszweig: Merge pull request #1369 from kumpelblase2/patch-1...
qard has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZpzi
<crystal-gh> crystal/master afad43e Ary Borenszweig: Added WebSokcet.open(String). Related to #1369
<crystal-gh> [crystal] jhass pushed 2 new commits to master: http://git.io/vZpz7
<crystal-gh> crystal/master 11500dc tebasaki: Add `Array#select!` and `Array#reject!` descriptions.
<crystal-gh> crystal/master 0faf94c Jonne Haß: Merge pull request #1499 from tebakane/add_select_reject...
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vZp2v
<crystal-gh> crystal/master e6a69f4 Ary Borenszweig: Merge pull request #1319 from technorama/f/socket_options...
<crystal-gh> crystal/master 3816b22 Technorama Ltd: Add Socket option helper methods....
<travis-ci> manastech/crystal#d200da9 (master - Merge pull request #1495 from jhass/base64_decode): The build passed. https://travis-ci.org/manastech/crystal/builds/80675728
sadin has quit [Remote host closed the connection]
<travis-ci> manastech/crystal#0faf94c (master - Merge pull request #1499 from tebakane/add_select_reject): The build was broken. https://travis-ci.org/manastech/crystal/builds/80676898
<travis-ci> manastech/crystal#5f08cb1 (master - Merge pull request #1369 from kumpelblase2/patch-1): The build passed. https://travis-ci.org/manastech/crystal/builds/80676014
<travis-ci> manastech/crystal#e6a69f4 (master - Merge pull request #1319 from technorama/f/socket_options): The build failed. https://travis-ci.org/manastech/crystal/builds/80677375
<dzv> is it possible to use LibC.printf "#{object_id}" in Object.finalize? getting compiler errors
vegai has left #crystal-lang [#crystal-lang]
waj has quit [Ping timeout: 246 seconds]
waj has joined #crystal-lang
<BlaXpirit> dzv, strange.. that's all i can say
<crystal-gh> [crystal] asterite closed pull request #1452: Allow comparison between different Iterable types. (master...f/slice_compare) http://git.io/vZVZf
<dzv> is the string in puts("foo") heap allocated per call or single allocated?
<jhass> it should be embedded into the data section of the binary
thor77 has joined #crystal-lang
<thor77> is there a macro for getter + setter?
<jhass> property
<thor77> ah, thanks :)
<thor77> (some documentation on build-in macros would be nice)
<jhass> thor77: http://crystal-lang.org/api/Object.html scroll down to Macro Summary
<thor77> uh, ty
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZpSc
<crystal-gh> crystal/master bd5fc72 Ary Borenszweig: Fixed #1476: wrong behaviour for union of classes that include abstract classes like Int
havenwood has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #1498: Improve HTTP::Cookies (master...cookie_sync) http://git.io/vZxcF
waj has quit [Ping timeout: 250 seconds]
waj has joined #crystal-lang
<travis-ci> manastech/crystal#bd5fc72 (master - Fixed #1476: wrong behaviour for union of classes that include abstract classes like Int): The build passed. https://travis-ci.org/manastech/crystal/builds/80685481
havenwood has quit [Ping timeout: 250 seconds]
<travis-ci> manastech/crystal#dbe78b7 (master - Merge pull request #1498 from jhass/cookie_sync): The build passed. https://travis-ci.org/manastech/crystal/builds/80686245
havenwood has joined #crystal-lang
ylluminate has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
bougyman has quit [Ping timeout: 256 seconds]
waj has quit [Ping timeout: 264 seconds]
havenwood has joined #crystal-lang
dfockler has quit [Remote host closed the connection]
waj has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vZht8
<crystal-gh> crystal/master 3206f67 Ary Borenszweig: Set a fixed type for string interpolations
<crystal-gh> crystal/master f2a5ebf Ary Borenszweig: Marking an `initialize` as private makes the autogenerated `new` method private
<travis-ci> manastech/crystal#f2a5ebf (master - Marking an `initialize` as private makes the autogenerated `new` method private): The build passed. https://travis-ci.org/manastech/crystal/builds/80697297
havenwood has quit [Ping timeout: 265 seconds]
elia has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
dfockler has joined #crystal-lang
waj has joined #crystal-lang
bougyman has joined #crystal-lang
apt-get has joined #crystal-lang
<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
apt-get_ has quit [Ping timeout: 246 seconds]
elia has quit [Quit: Computer has gone to sleep.]
dfockler has quit [Remote host closed the connection]
havenwood has joined #crystal-lang
<asterite> we didn't take a decision about what @@list represents there. Is it one for all instances or one for each instance?
<asterite> Or.. what do you want to do?
<waj> the error message means that currently you can do this: http://carc.in/#/r/fnu
waj_ has joined #crystal-lang
havenn has joined #crystal-lang
waj has quit [Ping timeout: 240 seconds]
havenwood has quit [Ping timeout: 244 seconds]
waj_ is now known as waj
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vZhwk
<crystal-gh> crystal/master 5f39286 Ary Borenszweig: Some simplifications in the parser and other location-related places
<crystal-gh> crystal/master 16202e0 Ary Borenszweig: Removed a duplicated spec and fixed some typos
waj has quit [Ping timeout: 260 seconds]
waj has joined #crystal-lang
<travis-ci> manastech/crystal#16202e0 (master - Removed a duplicated spec and fixed some typos): The build passed. https://travis-ci.org/manastech/crystal/builds/80710471
dyulax has quit [Quit: Saindo]
ylluminate has quit [Read error: Connection reset by peer]
ylluminate has joined #crystal-lang
dfockler has joined #crystal-lang
ssvb has quit [Ping timeout: 246 seconds]
ssvb has joined #crystal-lang
dleedev has joined #crystal-lang
<dleedev> are Threads supported in crystal?
<dleedev> I couldn’t find documentation anywhere regarding threads
<BlaXpirit> dleedev, you can make threads but it is not supported
<BlaXpirit> they break things
<BlaXpirit> the alternative is fibers
apt-get has quit [Read error: Connection reset by peer]
<dleedev> fibers in crystal support concurrency, but not parallelism, right?
<dleedev> how can I take advantage of multiple processor cores
apt-get has joined #crystal-lang
<BlaXpirit> dleedev, i guess you could use threads if you're very careful
<BlaXpirit> in the future fibers may run in a thread pool
<BlaXpirit> but now they're in one thread, yes
<dleedev> just saw this comment:
<dleedev> # Use spawn and channels instead.
<BlaXpirit> dleedev, that's fibers
<BlaXpirit> there are no synchronization primitives or communication methods
<BlaXpirit> for threads
<dleedev> so no mutexes?
<BlaXpirit> dleedev, u can get these things from some C lib
<BlaXpirit> oh so there are, i didnt know
<dleedev> fibers across thread pools sounds interesting
<BlaXpirit> dleedev, there aren't any threadsafe data structures , and I/O breaks
<dleedev> :(, so threads basically are a no-go?
<BlaXpirit> kinda
<dleedev> I’m guessing implementation in crystal is not reentrant?
<BlaXpirit> if you use threads just for computations and use UNIX pipes to give input and get output, then this seems ok
<dleedev> what if each thread holds its own local variables and all shared data or IO happens inside a mutex?
<BlaXpirit> i think IO must happen in main thread
<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
<BlaXpirit> hm a threadpooled 'map' seems like a fun project
<dleedev> is there a list of TODOS until 1.0?
<dleedev> I’m wondering if thread safety is in that list
<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
<jhass> ?roadmap
<DeBot> jhass: Nothing known about roadmap.
<jhass> ?roadmap=You can find the roadmap at https://github.com/manastech/crystal/wiki/Roadmap
<DeBot> jhass: Set roadmap.
<dleedev> ah, thanks
dfockler has left #crystal-lang [#crystal-lang]
ssvb has quit [Ping timeout: 252 seconds]
ssvb has joined #crystal-lang
<dzv> threads won't work with the io system, or the gc. so no threads
<BlaXpirit> not crazy at all, in my opinion :p
elia has joined #crystal-lang
havenn has quit [Ping timeout: 240 seconds]
<jhass> well it loops forever so you never ran it :P
<jhass> oh, nvm I read the assignment backwards
<jhass> all that locking will make it slow though
<jhass> probably better to shard the work
<BlaXpirit> well sure, there are better implementations, but it's something
<jhass> eg spawn a thread for each cpu and let it handle (i % n) == thread_number
ssvb has quit [Ping timeout: 240 seconds]
<BlaXpirit> then some threads will finish before others
<jhass> which doesn't have to be bad, especially with uniform workloads
ssvb has joined #crystal-lang
<BlaXpirit> the only simple thing i can think of is letting threads to N tasks at a time instead of 1
<jhass> requires synchronization too though
<BlaXpirit> sure, but N times faster :p
<jhass> which for many workloads will probably outweight some idle time
fowlduck has joined #crystal-lang
nakilon has quit [Ping timeout: 244 seconds]
ssvb has quit [Ping timeout: 252 seconds]
<BlaXpirit> about 3 times speed increase is pretty good anyway
<crystal-gh> [crystal] will opened pull request #1504: Set improvements (master...set) http://git.io/vZjJx
elia has quit [Quit: Computer has gone to sleep.]
<BlaXpirit> dleedev, the code i linked might be interesting to you
apt-get has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<dleedev> I wonder if it could be made to support lazy map
ssvb has joined #crystal-lang
<dleedev> basically, stream of input -> stream of output
<BlaXpirit> dleedev, sure it can. python does it
<BlaXpirit> i just made something quick
<BlaXpirit> hah, jhass, it appears that in Python they just implemented the exact idea i had :D https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map chunksize
havenwood has joined #crystal-lang
<BlaXpirit> welp, this chunking seems to have little effect
waj has quit [Ping timeout: 240 seconds]
waj has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
nakilon has joined #crystal-lang
elia has joined #crystal-lang
waj has quit [Ping timeout: 250 seconds]
waj has joined #crystal-lang
<BlaXpirit> aha, it does help immensely when there are tons of very very quick operations
nakilon has quit [Ping timeout: 246 seconds]
dleedev has quit [Quit: dleedev]
elia has quit [Quit: Computer has gone to sleep.]
nakilon has joined #crystal-lang
ssvb has quit [Ping timeout: 250 seconds]
nakilon has quit [Ping timeout: 260 seconds]
BlaXpirit has quit [Quit: Konversation]
ssvb has joined #crystal-lang
dleedev has joined #crystal-lang
fowlduck has quit [Quit: Leaving...]
waj has quit [Remote host closed the connection]
dleedev has quit [Read error: Connection reset by peer]
ylluminate has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] waterlink opened pull request #1505: Add `HTTP::Request#query_params` (master...http/add-query-and-body-params) http://git.io/vZj0L
<dzv> jhass: #1489 wouldn't a StaticArray satisfy your nonheap memory goal?