jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
deverly has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Philpax has joined #crystal-lang
deverly has joined #crystal-lang
deverly has quit []
ob_ has joined #crystal-lang
Dreamer3 has quit [Quit: Leaving...]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
ob_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 264 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit []
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
snsei_ has quit [Ping timeout: 264 seconds]
yllumina_ has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has quit [Read error: No route to host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
snsei has quit [Ping timeout: 264 seconds]
pawnbox has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
jsaak has quit [Ping timeout: 244 seconds]
jsaak has joined #crystal-lang
soveran has quit [Remote host closed the connection]
mark_661 has joined #crystal-lang
jsaak has quit [Ping timeout: 246 seconds]
jsaak has joined #crystal-lang
soveran has joined #crystal-lang
jsaak has quit [Ping timeout: 244 seconds]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 272 seconds]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 246 seconds]
jsaak has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
jsaak has quit [Ping timeout: 276 seconds]
akwiatkowski has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 244 seconds]
jsaak has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
jsaak has quit [Ping timeout: 272 seconds]
pawnbox has quit [Remote host closed the connection]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 252 seconds]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 250 seconds]
jsaak has joined #crystal-lang
pawnbox has joined #crystal-lang
jsaak has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 252 seconds]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 240 seconds]
jsaak has joined #crystal-lang
trapped has joined #crystal-lang
<FromGitter> <sdogruyol> i'm not sure why we still wanna keep LLVM 3.5 though https://github.com/crystal-lang/crystal/pull/2993
<BlaXpirit> sdogruyol, to still be able to build crystal on old distros, of course
<BlaXpirit> travis pls - ubuntu 12.04
<FromGitter> <sdogruyol> oh 12.04 is pretty old lol
<jhass> well we use docker containers on travis
<FromGitter> <sdogruyol> i wonder how Rust handles this?
<jhass> I think they build against 3.6 already anyway
<jhass> probably massive, own, CI setup
<FromGitter> <sdogruyol> since Rust has much more OS and platform to support
<jhass> mozilla has pretty big CI infra
<jhass> for FF alone
<FromGitter> <sdogruyol> oh i see, makes sense
<FromGitter> <sdogruyol> you're right
<FromGitter> <sdogruyol> damn, it's all about money isn't it :P
<BlaXpirit> yes
akwiatkowski has quit [Ping timeout: 244 seconds]
<BlaXpirit> damn, this is too difficult
<BlaXpirit> so let's say a C++ function returns a std::string - how do I wrap it into C and into Crystal so that I get a function which calls that and returns a String
<jhass> char* cpp_func() { return cpp.func().c_str(); } iirc
Raimondi has quit [Quit: All hail WeeChat 1.5-dev!]
<BlaXpirit> jhass, unfortunately that string is deleted when the function returns, and the pointer is invalid
<jhass> uh, guess you need to strcopy then?
<BlaXpirit> maybe I do but then the problem is disposing of it
<jhass> yes you have to use GC_malloc or LibC.free by hand
<BlaXpirit> that would make assumptions that crystal and c use the same LibC
<BlaXpirit> i found an interesting solution - using a static variable in C++ so it's not deleted
<BlaXpirit> not thread safe but it's something
<FromGitter> <sdogruyol> Meanwhile my talk about Crystal and Kemal from PolyConf is up https://www.youtube.com/watch?v=KJB-nAoRSr8
<FromGitter> <sdogruyol> hope you like it :P
jsaak has quit [Ping timeout: 240 seconds]
soveran has quit [Remote host closed the connection]
jsaak has joined #crystal-lang
jsaak has quit [Ping timeout: 276 seconds]
jsaak has joined #crystal-lang
Raimondi has joined #crystal-lang
soveran has joined #crystal-lang
<RX14> oh wow
<RX14> crystal -d actually works
<RX14> i've never got source annotations working before
snsei has joined #crystal-lang
akwiatkowski has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
Ven has joined #crystal-lang
jsaak has quit [Ping timeout: 250 seconds]
paulcsmith_ has joined #crystal-lang
ome has joined #crystal-lang
paulcsmith_ has quit [Client Quit]
paulcsmith_ has joined #crystal-lang
mark_661 has quit [Quit: Leaving.]
Philpax has quit [Ping timeout: 252 seconds]
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
paulcsmith_ has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Oliphaunte has joined #crystal-lang
jsaak has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jsaak has quit [Ping timeout: 276 seconds]
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ome has quit [Quit: Connection closed for inactivity]
paulcsmith_ has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Client Quit]
Redfoxmoon has quit [Ping timeout: 244 seconds]
jsaak has joined #crystal-lang
Raimondii has joined #crystal-lang
Redfoxmoon has joined #crystal-lang
Raimondii is now known as Raimondi
<crystal-gh> [crystal] asterite closed pull request #1851: Added type restrictions to many collections methods. Fixes #1764 (master...collections_type_restrictions) https://git.io/vKRP5
<crystal-gh> [crystal] asterite opened pull request #2996: Add restrictions to collection methods. Fixes #1764. Fixes #988 (master...feature/collections_restrictions) https://git.io/vKR1v
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Raimondii is now known as Raimondi
efi has joined #crystal-lang
<efi> Hi there!
<RX14> hi efi
<efi> I'm pretty new to crystal and have some basic questions... Is this the right place?
<RX14> yes, of course
<efi> Thanks!
<efi> typeof([0,0,0,"Hello"]) gives me Array(Int32 | String)
<RX14> yes
<efi> I need to get the inner union type (Int32 | String) - how can I extract that from the Array(T) Type?
<RX14> >> a = [0,0,0,"Hello"]; pp typeof(a), typeof(a.first)
<DeBot> RX14: typeof(a) # => Array(Int32 | String) - more at https://carc.in/#/r/13t7
paulcsmith_ has joined #crystal-lang
<RX14> basicallt typeof(arry.first)
<RX14> or any method that returns an item, but first makes more sense
<efi> Ah, "first" also has the broader type? Cool, thx!
<RX14> yes, because the compiler cannot reason about the order of elements
<RX14> so it has to assume that every element can be any type in the union
<efi> Thinking about it, that makes sense. :D
<RX14> of course tuples do not follow that logic
<efi> Yes, because the compiler knows them "better". Thx for the quick help. I think I'll return soon with another question. ;-)
<RX14> no problem
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
Redfoxmoon has quit [Ping timeout: 276 seconds]
Redfoxmoon has joined #crystal-lang
Redfoxmoon has quit [Ping timeout: 244 seconds]
<txdv> how doI turn a Pointer(UInt8) into a string?
<txdv> it is a null terminated string
Redfoxmoon has joined #crystal-lang
<BlaXpirit> txdv, String.new(that)
<txdv> nice, thanks
<txdv> this language is so awesome
<txdv> "I need to learn this language, why don't I write some bindings!"
<txdv> writing bindings is just so easy
<FromGitter> <sdogruyol> Yeah, Crystal is awesome :sparkles:
<txdv> is there something like a weak reference?
<jhass> no
<RX14> i just spent the afternoon trying to optimise header parsing and it ends up the same speed...
<RX14> well it was fin i guess
<FromGitter> <sdogruyol> RX14 you mean HTTP::Headers ?
<txdv> jhass: if i associate a pointer with an object (the object is a wrapper around it) it kinda will stop it from finalizing
<RX14> more like parse_headers_and_body and parse_header
<FromGitter> <sdogruyol> hmm
<RX14> i was thinking I could remove a malloc and stop iterating the string twice
<jhass> txdv: you store a pointer to an object in the object itself? or you mean the pointer won't be free'd until the object is free'd?
<RX14> but it ended up the same speed really
<FromGitter> <sdogruyol> hmm
Oliphaunte has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<txdv> i think i found a bug
<txdv> o no
<txdv> im stupid
soveran has joined #crystal-lang
<RX14> jokke, forgotten to merge my PR?
<txdv> jhass: i store the C pointer in the Crystal object
<jhass> I think I don't follow the issue
<txdv> wait, i'll post it
<txdv> this returns a new reference
<txdv> if I have repo, i can do repo.head.owner and it should be the same object
<txdv> but I create a new Repository for the same C pointer
<txdv> what is the best way to circumvent this?
<jhass> will either Reference or Repository ever be mutable, I mean will you wrapper have mutable state (additional instance variables)?
<txdv> no, but it has a finalize method
<txdv> i mean, if one of those objects frees the underlying c pointer, the others cant access it anymore
<jhass> mh, no reference counting?
<BlaXpirit> does any Crystal project use CMake? alternatively, I'm looking for some build system that can be helpful with both C++ and Crystal
<RX14> uhh
<RX14> make?
<RX14> i mean can't you just call whatever build system for C++ from crystal
<jhass> txdv: reference_type / reference_free is not reference counting?
<RX14> it doesn't have to be the same build system for crystal and C++ BlaXpirit
<BlaXpirit> RX14, I don't want a crazy complicated sandwich. would prefer one build system
<RX14> its not that difficult
<RX14> is this for a shard?
<BlaXpirit> believe me, with C++ it is difficult
<RX14> well the C++ doesn't depend on crystal code right?
<txdv> you mean if the C _free functions have reference counting/
<BlaXpirit> RX14, i'm making a library that consists of C++ -> C binding and C -> Crystal binding
<RX14> ah
<jhass> txdv: yes
<RX14> well
<RX14> just use make
<txdv> no
<RX14> its not using multiple build systems
<RX14> because crystal doesn't need a build system
<BlaXpirit> i really can't drop the cmake part, people will get grief when building a shared library otherwise
<BlaXpirit> besides, one day Windows will come, what will i do
<RX14> doesn't cmake just use make anyway
<RX14> i thought it just generated makefiles
<BlaXpirit> RX14, it has tons of backends letting it run on windows
<RX14> well crystal used to call the c compiler from macros
<RX14> i really don't get why you need a build system more then compile all C++ targets then call crystal build
<txdv> jhass: i guess i can do the reference counting myself
<txdv> but then the repo object wrappers are != to each other
<jhass> that's easily fixable, just compare the internal pointers
<jhass> but reference counting requires global state either way, so could just dedup
<jhass> either is a bit meh
<RX14> BlaXpirit, if it's a shard just use postinstall hooks in shards
<txdv> dedup?
<jhass> INSTANCES = Hash(Pointer, Repository).new
<jhass> txdv: might be easier to reimplement these tbh
<jhass> def owner; @owner || Repository.new(LibGit2.reference_owner(@ref)); end
<txdv> but if i have INSTANCES around
<txdv> the objects in INSTACES will never be freed
<jhass> how does rugged solve this?
<RX14> it seems like it doesn't
<jhass> yeah, just doesn't implement owner
<RX14> well it doesnt seem to implement much
pawnbox_ has joined #crystal-lang
<txdv> libgit2sharp just passes the object reference
<RX14> yeah thats what I would do
<jhass> you could pass a flag whether you "own" the reference
<jhass> def finalize; ...free(@ref) if @owned; end
pawnbox has quit [Ping timeout: 276 seconds]
<RX14> but i think just passing the owner into the child is easier
<RX14> when it's instantiated
<txdv> repo is a god object
<RX14> thats how rugged does it
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vK0q7
<crystal-gh> crystal/master f6874e1 Ary Borenszweig: String: always compute codepoints size when ascii optimization is available...
<travis-ci> crystal-lang/crystal#f6874e1 (master - String: always compute codepoints size when ascii optimization is available): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/144830121
efi has quit [Ping timeout: 250 seconds]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi^1 has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
<RX14> huh
<RX14> webui says its still going lol
Raimondii has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] asterite closed pull request #2973: Add IO::Delimited (master...feature/delimited-io) https://git.io/vKsjK
<travis-ci> crystal-lang/crystal#f6874e1 (master - String: always compute codepoints size when ascii optimization is available): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/144830121
Raimondi^1 is now known as Raimondi
Raimondi is now known as Raimondii
<jhass> RX14: ary probably restarted it
<RX14> oh
Raimondii is now known as Raimondi
<FromGitter> <sdogruyol> RX14 isnt mime pr already complete?
<RX14> no
<RX14> i havent added formdata helpers
<FromGitter> <sdogruyol> what's missing
<RX14> which i'm working on right now
<FromGitter> <sdogruyol> i see
<FromGitter> <sdogruyol> tbh i can't wait for it :P
<RX14> its been hanging around for so long i've almost gotten bored of working on this PR
<FromGitter> <sdogruyol> well, yeah that's definitely a bummer
<FromGitter> <sdogruyol> i also wonder how's that paralellism stuff is going on
<RX14> this should always produce a valid content type right? https://aww.moe/wvis2j.txt
<jhass> RFC1341 seems to list only multipart/mixed, multipart/alternative, multipart/digest and multipart/parallel
<RX14> jhass, yes because multipart/formdata is a seperate rfc
<jhass> but if I pass foobar to it it's invalid
<RX14> see the section on extension types
<jhass> eh, meh yeah
<jhass> is there no registry for this? :/
<RX14> well
<RX14> there's the generic mime registry
<RX14> yep
<RX14> i'm not hardcoding that into crystal though :P
<jhass> ok
<jhass> maybe reject known not-working?
<RX14> what?
<RX14> why not just let people use whatever subtype they want!
<jhass> nvm
<jhass> I thought some might actually influence the general format
<RX14> no
<RX14> it says in the rfc
<RX14> All present and future subtypes of the "multipart" type must use an
<RX14> identical syntax. Subtypes may differ in their semantics, and may
<RX14> impose additional restrictions on syntax, but must conform to the
<RX14> required syntax for the "multipart" type.
<jhass> ok
<travis-ci> crystal-lang/crystal#33697ab (master - Merge pull request #2973 from RX14/feature/delimited-io): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/144843225
willl has joined #crystal-lang
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Oliphaunte has quit [Remote host closed the connection]
Ven has joined #crystal-lang
<RX14> is there any sort of preexisting way to "unquote" strings from http headers
<FromGitter> <aurelien-ldp> Hello ! I just want to convert a Int32 to Float64, any ideas ?
<jhass> call to_f64 ;)
<BlaXpirit> >> 5.to_f64
<DeBot> BlaXpirit: # => 5.0 - https://carc.in/#/r/13tq
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
<FromGitter> <aurelien-ldp> Of course to_f like ruby, thanks a lot :)
Ven has quit [Client Quit]
Philpax has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 244 seconds]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
jsaak has quit [Ping timeout: 240 seconds]