RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
snsei 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
snsei 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
snsei 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
snsei 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
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
relyks has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
<jokke> hey. i'm having some problems with macro generated methods and docs: https://ipfs.jokke.space/ipfs/QmWE8eV9ixxuAYQvQpnDv5kH9K7WnkrHnbVyL5mWWoHp2M/
<jokke> this is the code ^
<jokke> as you can see there ^ the links won't generate probably
<jokke> *properly
return0e_ has quit [Remote host closed the connection]
return0e has joined #crystal-lang
hmelaine has joined #crystal-lang
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS mtzhyynxr: hightower4 mjblack Liothen ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS jyoqyia: binBASH dyreshark hightower2 ▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS rnfarskzct: mroth faustinoaq lvmbdv ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS yiykryyt: SuperChickeNES jeromegn DeBot ▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS qhjpgwtq: Guest34371 maxpowa lvmbdv ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS lmnlv: OceannBoy jeromegn binBASH ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS uzmbzuspy: pabs dahhowl OceannBoy ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS jpqmrpjqd: shelvacu DeBot faustinoaq ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄,
<hmelaine> ▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS ojmkegcnsm: foca snsei txdv ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS pskcoiymoi: lvmbdv hightower2 dannyAAM ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS huqueh: Kug3lis DeBot juni0r ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS fyllr: OceannBoy hightower2 sevensidedmarble ▄▄▄▄▄▄▄▄▄▄▄▄▄▄
OceannBoy has quit [Ping timeout: 276 seconds]
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS huiiukwqtd: hightower2 foxbot g3funk ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
return0e has left #crystal-lang [#crystal-lang]
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS bmlzxmby: [spoiler] txdv g3funk ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS ilzllkvavh: juni0r dyreshark pabs ▄▄▄▄▄▄▄▄▄▄
<hmelaine> â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS mokslnp: dahhowl [spoiler] tliff â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–
jnyw has quit [Quit: WeeChat 2.0.1]
<FromGitter> <picatz> :|
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS wtbeyurkha: c-c sevensidedmarble jhass ▄▄▄▄▄▄▄▄▄▄▄▄▄
<faustinoaq> Please, ban this bot :(
<jokke> :/
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS josun: mroth jeromegn go|dfish ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS oxtrpnb: c-c jhass salvor ▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<jokke> why is this channel getting so much spam?
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS hikfr: salvor DTZUZU return0e ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS kacfn: andersh go|dfish jsn- ▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS mgwze: juni0r dostoyevsky jfontan ▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS tswgr: return0e SuperChickeNES Kug3lis ▄▄▄▄▄▄▄▄▄▄▄▄▄▄
<hmelaine> â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS hnefj: chrisarcand go|dfish Cyrus â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS gspye: jfontan binBASH lvmbdv ▄▄▄▄▄▄▄▄▄▄
<FromGitter> <picatz> Why is this bot so badly programmed.
<FromGitter> <picatz> :|
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS jovazfe: ephemera_ chrisarcand DTZUZU ▄▄▄▄▄▄▄▄▄▄
<hmelaine> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ##FEMINISM IS OFFERING TRAINING IN TAPPING INTO YOUR INNER FETISHES!! EL IS IN #FREENODE FOR ANY QUESTIONS vltknb: g3funk wmoxam foxbot ▄▄▄▄▄▄▄▄▄▄▄
hmelaine has quit [K-Lined]
<jokke> picatz: not crystal
<jokke> :D
<FromGitter> <picatz> Right? :P
<jokke> so just that my question doesn't disappear under all that spam:
<jokke> hey. i'm having some problems with macro generated methods and docs: https://ipfs.jokke.space/ipfs/QmWE8eV9ixxuAYQvQpnDv5kH9K7WnkrHnbVyL5mWWoHp2M/
<faustinoaq> jokke, I don't know, but #amber is almost 0 spam
<jokke> as you can see there ^ the links won't generate probably
<faustinoaq> Hi how can I check if a crystal program is running with privileges, in ruby: `isRoot = Process.uid.zero?`, in crystal?
<faustinoaq> jokke, thank you!
greengriminal has joined #crystal-lang
<jokke> np
<jokke> lets hope the pr author gets his/her commits together :P
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
sz0_ has joined #crystal-lang
sz0_ is now known as sz0
wontruefree has joined #crystal-lang
faustinoaq has quit [Ping timeout: 276 seconds]
faustinoaq has joined #crystal-lang
<Papierkorb> In case that spam shit continues, if I don't react (and there's a chance I'm not afk) myself, ping me by mentioning me. Banning that punk is no issue after that.
<Papierkorb> jokke: Your TLS cert is broken, the p one doesn't have the ipfs one as alt name
<Papierkorb> jokke: You may like my jsonrpc shard btw, I wrote it for a btc related project, so it totally can talk to bitcoind
relyks has joined #crystal-lang
relyks has quit [Quit: relyks]
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
cremes has quit [Quit: cremes]
relyks has joined #crystal-lang
relyks_ has joined #crystal-lang
OceannBoy has joined #crystal-lang
relyks has quit [Ping timeout: 256 seconds]
relyks__ has joined #crystal-lang
relyks has joined #crystal-lang
relyks_ has quit [Ping timeout: 256 seconds]
relyks__ has quit [Ping timeout: 256 seconds]
relyks has quit [Ping timeout: 256 seconds]
relyks has joined #crystal-lang
hightower4 has quit [Remote host closed the connection]
<FromGitter> <Dillybob1992> hey guys, im trying to read my tcp socket data has messages ⏎ ⏎ ###client: ⏎ ⏎ ``` loop do ⏎ msg = socket.read_string(socket.recv_buffer_size) ⏎ puts msg``` ... [https://gitter.im/crystal-lang/crystal?at=5a5adb28ce68c3bc74b548b8]
relyks has quit [Quit: relyks]
<FromGitter> <bew> Call `socket.flush` after the last sent data, to actually sent it
<FromGitter> <Dillybob1992> hmm, just added that no diff :O
<FromGitter> <Dillybob1992> `socket.recv_buffer_size` is this doing what i think its doing ?
<FromGitter> <bew> No idea, did you wrote it?
<FromGitter> <bew> If not, then no
<FromGitter> <bew> It's probably not in the public/documented API
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
OceannBoy has quit [Ping timeout: 255 seconds]
relyks has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
<FromGitter> <bew> yeah, that's something not documented, and absolutly not what you want
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<FromGitter> <bew> also, whether you want to do your own thing, you should only use documented stuff, unless you know exactly what you're doing
greengriminal has quit [Quit: This computer has gone to sleep]
alex`` has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
faustinoaq has quit [Quit: IRC client terminated!]
relyks has quit [Quit: relyks]
snsei has joined #crystal-lang
jnyw has joined #crystal-lang
<lvmbdv> jokke: you run a ipfs portal?
<lvmbdv> cool man
alex`` has quit [Quit: WeeChat 1.9]
jnyw has quit [Quit: WeeChat 2.0.1]
<ua> RX14, got itttttttt
<ua> %q{ } can be used as multiline comment without interpolation
sz0 has quit [Quit: Connection closed for inactivity]
<RX14> Ok
handicraftsman has left #crystal-lang ["Leaving"]
<jokke> Papierkorb: ah cool, i'll have a look!
<jokke> Papierkorb: p and ipfs are separate certs
<jokke> should both be valid though
<jokke> lvmbdv: haha yeah, until the first abuse mail comes in at least :P
hightower4 has joined #crystal-lang
<hightower4> I see option --static for building in 0.24.1. Was it fixed?
<RX14> it probably doesnt work for you unless you're on alpine linux
Ven`` has joined #crystal-lang
<hightower4> What does option --threads default to when building?
<RX14> all of em
<hightower4> ++
<RX14> wait what, it defaults to 8?
<RX14> @asterite is that intentional?
Ven`` has quit [Ping timeout: 276 seconds]
Ven`` has joined #crystal-lang
hightower3 has joined #crystal-lang
Ven` has joined #crystal-lang
tatey has quit [Ping timeout: 255 seconds]
Ven`` has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 256 seconds]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vNcJ9
<crystal-gh> crystal/master c7cc787 Jamie Gaskins: Pretty-print objects in playground inspector (#4601)
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<travis-ci> crystal-lang/crystal#c7cc787 (master - Pretty-print objects in playground inspector (#4601)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/328694591
<DeBot> https://github.com/crystal-lang/crystal/pull/4601 (Pretty-print objects in playground inspector)
<FromGitter> <asterite> I think so. I think with more forks it becomes slower to compile, but you can play with that number, maybe it's not the best
<RX14> hmm
<RX14> well hopefully thinlto solves this
<RX14> I think it matters on osx and linux too
wontruefree has joined #crystal-lang
<hightower4> How do I run a build without using any cached .o files?
<RX14> why?
<RX14> delete ~/.cache/crystal
<hightower4> just some speed tests
<RX14> ok
<RX14> yeah just delete ~/.cache/crystal
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
wontruefree has joined #crystal-lang
DTZUZU has quit [Read error: Connection reset by peer]
cremes has joined #crystal-lang
<FromGitter> <asterite> RX14 I can later try to fix the issue with the corrupt cache. What did you suggest to do?
<RX14> @asterite File.move is atomic, so generate the files to tempoary names, and only move the files to their correct locations to be used *next time* when the compilation suceeds completely
<RX14> it solves the case of corrupt or incomple .o files when the compiler is interrupted when writing out the object files
<RX14> since the incomplete object files are never moved to the correct place
<RX14> and then a short pass at the beginning of the compiler run could possibly clean up the folder for any tempoary .o files
<FromGitter> <asterite> I think that last thing might not be needed, eventually the compiler will erase that folder if the program isn't compiled after a few times. And maybe those files don't bother in the cache (if they weren't moved because of an interruption)
<RX14> yeah
<RX14> i was thinking it was optional too
<RX14> but not hard:
<RX14> just have a prefix for the tempfiles
<RX14> then Dir.each() { |f| File.delete(f) if File.basename(f).starts_with? '-' }
<RX14> or similar
ogotai has joined #crystal-lang
<RX14> but not important
<ogotai> hi all, are the pointer types (e.g. "Void*") used anywhere else in Crystal, other than between lib ... end? I know Pointer type exists, but the C-style asterisk pointers don't seem to be documented anywhere
<RX14> they can be used anywhere
<RX14> Void* is just a shorthand for Pointer(Void)
<RX14> just like {Foo, Bar} is a shorthand for Tuple(Foo, Bar)
<RX14> and it's only at the type level
<RX14> there's no * operator on pointers
<RX14> or & for pointerof
<ogotai> got it, thank you - and the reverse of that is true as well presumably, I could use "fun funname(abc : Pointer(Void))", istead of "fun funname(abc : Void*)" in lib declarations?
<RX14> of course
<RX14> they're equivalent to the compiler
<FromGitter> <asterite> Maybe we could remove those aliases. They are convenient but lead to confusion
<FromGitter> <asterite> Pointer(Void) works anywhere, but Void* doesn't
<ogotai> I noticed most people seem to be using asterisk notation when linking to C functions in libs, and Pointer declarations when writing regular Crystal, which is why I was wondering if each is only allowed in those places
<ogotai> follow up question - I see lots of "LibC::Int" and similar types in lib declarations again, are those documented anywhere, do they map directly to C types?
<FromGitter> <asterite> Documented a bit here: https://crystal-lang.org/docs/syntax_and_semantics/c_bindings/fun.html
<RX14> @asterite ideally LibC should ge generated
<ogotai> great, that helps a lot, thanks guys
<RX14> which makes the need for Void* even less
<crystal-gh> [crystal] asterite opened pull request #5585: Compiler: emit `.o` file to a temporary location and then atomically rename it (master...refactor/improved-cache) https://git.io/vNctC
<FromGitter> <asterite> RX14 I think in most cases it is, that file is probably a left over from older days
<RX14> @asterite the travis problem isn't this one
<FromGitter> <asterite> what travis problem?
<RX14> the compiler failed once or twice on travis with weird .o corruption
<RX14> i'm just saying it can't be solved by this PR since the compiler is never interrupted
Ven`` has joined #crystal-lang
<RX14> I've never had ~/.cache/crystal become corrupted in the last year
<RX14> and I use a compile-on-change tool which kills the compiler a lot
<RX14> well, can kill the compiler
<FromGitter> <asterite> Hm, then it's strange
<FromGitter> <asterite> I bumped into the cache issue a few times recently
<FromGitter> <asterite> not sure why it would happen in travis, though...
DTZUZU has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
<RX14> @asterite well this is just my suggestion and I think it's a good thing to do anyway
<jokke> any idea what's going on here? https://p.jokke.space/m-otX/
<RX14> the error message is broken
<jokke> oohh
<RX14> but Proc is already defined
<jokke> dang
<jokke> ok
<jokke> so ::Proc should do the tric
<jokke> k
<jokke> indeed it does
<jokke> thanks!
greengriminal has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
Groogy2 has joined #crystal-lang
Groogy has quit [Disconnected by services]
Groogy2 is now known as GRoogy
GRoogy is now known as Groogy
Groogy_ has joined #crystal-lang
emilsp has joined #crystal-lang
<emilsp> so, crystal init app babies_first creates a new """project"""
<emilsp> how do I build the newly created project?
<jokke> can i i~
<jokke> oh
<jokke> sorry
<jokke> can i somehow use forward_missing_to on class level?
<jokke> emilsp: with shards build
<RX14> emilsp, `shards build` or `crystal build src/your_file.cr`
<oprypin> jokke, no
<RX14> the latter is more general and you should know well
<jokke> oprypin: oh :(
<RX14> the former is shorter
<jokke> the former also puts the binarys in a dir that's in gitignore, which is always a plus ;)
<jokke> oprypin: is there an obvious reason why that's not possible?
<oprypin> macros don't act at class level
<jokke> mh
<RX14> hmm
<RX14> i presume people have tried macros and extend self
<RX14> because extend self should *theoretically* place the macros on the superclass
<RX14> which could respond to method_missing
<RX14> I have 0% faith that that works
<jokke> :D
Groogy has quit [Quit: WeeChat 2.0.1]
faustinoaq has joined #crystal-lang
<greenbigfrog> no shard yet for QR code generating?
<RX14> if it's not on google, probably not
<emilsp> thanks jokke and RX14
<FromGitter> <lbguilherme> Hello everybody, I have been doing some work on a RethinkDB driver library for crystal, but looks like I just hit a wall: ⏎ ⏎ This a valid query: ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5a5b75d35ade18be3974ebb3]
<greenbigfrog> I'll just use some online service in that case. if anyone deos write one, lemme know
<greenbigfrog> thanks
<emilsp> greenbigfrog: you can always try and use a C library for that
<FromGitter> <sdogruyol> @lbguilherme I'm pretty sure we had an issue about block overloading
<greenbigfrog> hm. that should also work
* greenbigfrog is lazy though
<FromGitter> <sdogruyol> @lbguilherme https://github.com/crystal-lang/crystal/issues/5090
<FromGitter> <lbguilherme> That's sad... thanks @sdogruyol. Maybe I can do something with macros here
<emilsp> might be a stupid question but after staring at the docs for FileUtils and File, I've not found a way to list files in a directory
<emilsp> which is because I wasn't looking at Dir
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
<jokke> hm what happened to SecureRandom.uuid?
<RX14> UUID.random
<jokke> oh ok
<jokke> hm
<jokke> not in the docs
<RX14> yeah
<RX14> it got missed from doc_main
<jokke> hm also not found as a constant
<RX14> require "uuid"
<jokke> ah
<jokke> makes sense :P
<RX14> lol
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <faustinoaq> > Does anyone know some trick I can use here? ⏎ ⏎ @lbguilherme Maybe you can try this: ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5a5b89c5ae53c15903e8091b]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <faustinoaq> > I believe lambdas already cover this, and your suggestions already apply to them. Since you are capturing the block for later use, in your initial example, I believe using a lambda is a better solution than trying to type block arguments. See https://github.com/crystal-lang/crystal/blob/master/src/logger.cr#L93 for example. ⏎ ⏎ https://github.com/crystal-lang/crystal/issues/5090#issuecomment-336447069
<FromGitter> <lbguilherme> I have settled up with having a single "overload" taking many arguments (say 5), then after the whole query is generated, dynamically traverse the tree to analyze which variables are used and which are not used. Then remove the unused one and count the remaining. This is a little too much, but should do what I want without breaking the interface. @faustinoaq I considered this, but looks awful to use :(.
<FromGitter> ... Would be my last hope solution.
<jokke> is 
<jokke> is it possible to use option parser in such a way that it will just ignore unknown options?
<jokke> i need an initial option parser to parse a config option which i need for the second parser
<jokke> ah
<jokke> reading docs helps
alex`` has quit [Ping timeout: 256 seconds]
alex`` has joined #crystal-lang
sz0 has joined #crystal-lang
hightower4 has quit [Ping timeout: 255 seconds]
<greenbigfrog> Anyone got an idea why I'm getting this error, even though I'm 99% sure I'm passing a string as argument? https://gist.githubusercontent.com/greenbigfrog/0e3cf9059b7370544120ff9baec0b928/raw/80de6fc657c3ab537c1bb21f270bf89b0d167821/gistfile1.txt
<Papierkorb> that's a runtime error.
<Papierkorb> "for" is not an integer
hightower4 has joined #crystal-lang
<greenbigfrog> where is that `for` coming from though?
* greenbigfrog is confused
<greenbigfrog> Papierkorb: ?
<FromGitter> <bew> Looks like it's the string you're trying to convert to Int32
<Papierkorb> probably the strings content.
<greenbigfrog> why is it being converted though...
<greenbigfrog> sometimes I get the error, sometimes I don't
<FromGitter> <Dillybob1992> how do we send the correct bytes tot he socket to be read as individual messages? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ then on the server, we use `socket.read_string(bytesizeherebutwherefrom)` [https://gitter.im/crystal-lang/crystal?at=5a5b9d21ce68c3bc74b82c2c]
<FromGitter> <bew> No
<FromGitter> <bew> send_buffer_size, like recv_buffer_size has nothing to do with the actual data you want to send
<FromGitter> <marksiemers> @greenbigfrog - If you are using HTTP, then the `body` is going to be text (a string) so if part of the body needs to be an integer, then part of it needs to be converted from String to an integer.
<FromGitter> <bew> Those methods are configuration methods for the socket, used by the stdlib to do specific things, they are not meant to be used by you
<FromGitter> <Dillybob1992> ohh ok
<FromGitter> <bew> Just use read* or write* methods, e.g: `write_bytes(Int32, the_payload_size)`
<FromGitter> <marksiemers> hmm, I'm having a hard time tracking in the code and error trace where things are going wrong though
<FromGitter> <marksiemers> `:jsonrpc => "1.0"` - this is the only obvious thing that sticks out as possibly causing a problem trying to convert to an integer.
<FromGitter> <bew> @Dillybob1992 and `payload_size = socket.read_bytes(Int32)` to read it on the other end
<FromGitter> <Dillybob1992> kk awesome let me try this
<crystal-gh> [crystal] lbguilherme opened pull request #5587: Fix strdup for LibXML: undefined behavior (master...patch-10) https://git.io/vNcBd
<FromGitter> <marksiemers> Is it possible that this key-value: `"amount" : 1000.00000000` has a decimal sometimes?
<FromGitter> <marksiemers> Can you test with `"amount" : 1000.10000000` ?
<greenbigfrog> still works (the test.cr that is)
<greenbigfrog> weird...
<FromGitter> <Dillybob1992> `socket.write_bytes(Int32, msg_to_send.bytesize)` gives me
<greenbigfrog> calling `get_transaction` in test.cr works, and the other one as well (partly) all of a sudden
<greenbigfrog> and it doesn't again
alex`` has quit [Ping timeout: 256 seconds]
<greenbigfrog> added you to the private repo marksiemer
<FromGitter> <l3kn> @Dillybob1992 `socket.write_bytes(msg_to_send.bytesize)` should do what you need
<FromGitter> <Dillybob1992> i see, no error now. but how does it know the message i sent
<FromGitter> <Dillybob1992> if it's only in bytes, is it encoded?
<FromGitter> <l3kn> This is not sending the message, just the size
<FromGitter> <l3kn> Next, you would need to send the message itself
<FromGitter> <Dillybob1992> ohhhhhhhh
<Papierkorb> Dillybob1992, Have you considered using an existing protocol instead of rolling your own?
<FromGitter> <l3kn> and then on the other side (receiver), first do a `socket.read_bytes(Int32)` to read the size you sent
<FromGitter> <Dillybob1992> i was going to use the kemal websocket module but the game engine i use doesn't have websocket support. this TCP stream stuff is really hard but glad im getting help understanding it here :)
<Papierkorb> Can't you bind to the game engines network library?
<FromGitter> <Dillybob1992> @l3kn ok will try
<ogotai> Why does the compiler complain about type name, when I "type OM_uint32 = LibC::UInt" and declare "fun x(param1 : OM_uint32)", pass an Int32 to it, while if I declare "fun x(param1 : Libc::Uint)" directly, it no longer complains? The complaint in the first instance is "must be OM_uint32, not Int32"
<FromGitter> <Dillybob1992> OH wow! so `read_bytes(Int32)` doesn't take in the amount of BYTES
<FromGitter> <Dillybob1992> it just takes in the Type!?
<FromGitter> <Dillybob1992> I think I got it working!!
<ogotai> Am I supposed to "hide" the type later in the crystal lib wrapper for the C functions, cause the lib users presumably shouldn't be expected to use all the exotically named typedefs in the C library I'm trying to wrap right?
<RX14> yep
<ogotai> thanks
<RX14> you're expected to only use the lib def inside your shard
<RX14> and expose a sanitized crystally OO interface
<FromGitter> <marksiemers> @greenbigfrog - I don't know if I'll be able to spend a lot of time with it today, but I've cloned the repo. ⏎ Is it possible to write a `Spec` that reproduces the error?
<RX14> lib definitions actually are automatically ignored by the doc tool
<greenbigfrog> not really. I can't get it to either fail across all calls or to work...
<ogotai> makes it slightly difficult to write the lib, was hoping to define all types exactly as they're named in the C library, and then just copy&paste function definitions effectively - this way I'll have to convert the type names for every function - a bit more work
<FromGitter> <l3kn> @Dillybob1992 When you are sending something (like`message.size`) crystal “knows” the type (Int32) and sends it as 4 bytes
<FromGitter> <Dillybob1992> Ohh, so that's why stream_peer.cpp (https://github.com/godotengine/godot/blob/e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c/core/io/stream_peer.cpp#L214) sends the length! Now I am starting to finally understand!
<FromGitter> <l3kn> to read it back in, you need to tell it what type it was
<FromGitter> <Dillybob1992> understood fully now, this is really neat
<Papierkorb> ogotai: There are a few automatic/semi-automatic binding generators around. If this isn't a really small lib, it might be worth it checking them out
<FromGitter> <bew> @Dillybob1992 was on phone, wasn't sure about the method args, 'glad it's working now!
<ogotai> Papierkorb: any better ones than "crystal_lib" that you know of the top of your head by chance?
<FromGitter> <bew> libgen ogotai?
<FromGitter> <Dillybob1992> @bew && @l3kn 👍 👏
<FromGitter> <bew> https://github.com/olbat/libgen @ogotai
<Papierkorb> ogotai: I dev&maintain github.com/Papierkorb/bindgen, it falls in the semi-automatic category.
<ogotai> bew, thanks will check that out
<FromGitter> <bew> it uses crystal_lib, but has a nicer interface (YAML config
<RX14> well
<RX14> bindgen can do Qt
<RX14> so i'm going to class it in a different league to that libgen can do
<greenbigfrog> so this never fails... if I call `rpc.get_transaction("b36a3886e24e4c0af5fc0a037cbe20738bc76f7459e1ab471d5c21202c87a37f")` inside my code, it sometimes fails with the`Invalid Int32: for` and soemtimes it doesn't https://gist.githubusercontent.com/greenbigfrog/8643f7bce58756288f612701c4e784db/raw/ea75ab655fe9f78c2acdb7979a7a760f23fea298/gistfile1.txt
<olbat[m]> Well, libgen is just a small wrapper on crystal_lib (that does not seems to be maintained anymore ?), bindgen in the other hand seems to be a more complete and robust tool ...
<FromGitter> <marksiemers> @greenbigfrog - It is a little too much setup for me to dig in and reproduce the problem (setting up the wallets and the databases for each coin). ⏎ If there is a way to reduce the problem or automate the setup with same throw-away wallets, then I'm happy to help.
<greenbigfrog> I'm trying...
<olbat[m]> If you like the way to create bindings using YAML/JSON files, I can try to work on interfacing libgen with bindgen :)
<Papierkorb> ...?
<Papierkorb> Bindgen already uses YAML configs
<olbat[m]> Oh yeah ? My bad, sorry I didn't know that ...
<RX14> what it doesn't do is the no setup @[Include("foo.h")] angic or anything like it
<RX14> magic*
<RX14> I think making it too easy is a bit of a bad idea myself
<RX14> C bindings are nowhere near robust enough to be used by people who can't write C
<FromGitter> <Dillybob1992> can we have global constants, for example, MAX_PAYLOAD_SIZE?
<RX14> @Dillybob1992 yes, just put them at the top level
<Papierkorb> Just stuff them into a class or module where it fits
<FromGitter> <Dillybob1992> sweet, ty
<RX14> but yes
<RX14> it's recommended to put your whole application in one module
<RX14> like module GameServer
<RX14> and put everything in your project in that
<FromGitter> <Dillybob1992> oh yea, i should prob put it in there
<RX14> that doesn't mean one file
<RX14> i hope you understand
<FromGitter> <Dillybob1992> i will eventually ^_^
<FromGitter> <Dillybob1992> im slow :D
<RX14> not really
<RX14> you seem to be doing fine
<FromGitter> <Dillybob1992> thank you =]
<RX14> at least you're willing to learn, and put the effort in, unlike some people who come here for advice
<olbat[m]> Thank you for the link Papierkorb, I'll take a look at it, it seems to be really customisable :)
<ua> Dillybob1992, ive found that %q{ } doesnt do string interpolation as opposed to %Q{} ;)
<RX14> Papierkorb, you use libclang, but custom bindings in bindgen right?
<Papierkorb> RX14: libclang, but controlled from a C++ process
<RX14> oh
<ua> do --release already uses all possible optimization or can I tweak it even more?
<FromGitter> <Dillybob1992> @ua, ya i just googled how to multi comment on subtlime i heard its CTRL+/ so i jus tuse that now lol
<RX14> ua, all of them
<RX14> yay
<ua> eh okay thanks
<RX14> see
<ua> noooooooOOOOOOO
<RX14> this is why we don't have a multiline block comment syntax
<ua> ;P
<Papierkorb> Cause the C bindings are weird and lack many essential features
<FromGitter> <Dillybob1992> haha, never knew about it until starting to use crystal too, which is cool
<RX14> Papierkorb, so you wrote a C++ application which just dumps clang's data to JSON?
<RX14> that's cool
<Papierkorb> Basically, yes
<RX14> seems like a decent standalone tool tbh
<RX14> it must be fairly language agnostic
<Papierkorb> In a future upgrade that thing would turn into a "daemon", to ask it at runtime to figure something out. Then bindgen could do full auto-discovery
<RX14> what do you mean by "full auto-discovery"?
<Papierkorb> You just tell it "I want QObject and everything that derives from it too"
<RX14> oh
<RX14> cool
<Papierkorb> You could kinda do that right now by passing a flag to make it do that, but I don't like how that'd hand over the control of the whole process to the clang daemon.
<FromGitter> <Dillybob1992> is it possible to check if a msg is valid JSON?
<FromGitter> <bew> Try to parse it?
<FromGitter> <Dillybob1992> it raise error?
<FromGitter> <Dillybob1992> ```code paste, see link``` ⏎ ⏎ this works good, if the client does send a valid json. However, if the client sends wrong json, the loop breaks and no error is raised (i rescue below). do i need to check if `JSON.parse(msg).nil?` maybe? [https://gitter.im/crystal-lang/crystal?at=5a5bb2265a9ebe4f758780c1]
<FromGitter> <bew> Yes, you need to rescue the exception if it fails, which would mean that it's not valid json
woodruffw has quit [Ping timeout: 240 seconds]
<FromGitter> <Dillybob1992> LOL WOW, i had a `break` right below the rescue so the error wasn't showing
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #5587: Fix strdup for LibXML: undefined behavior (master...patch-10) https://git.io/vNcBd
sandelius has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
<travis-ci> crystal-lang/crystal#b4fed51 (master - Fix strdup for LibXML: undefined behavior): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/328809661
<FromGitter> <Dillybob1992> is it possible to make a method break out of its loop do from another function? for example, i have a `def spammer loop do sleep(0.1) socket << "msgs" end` and once the client has been disconnected from server (i check that in my spawn handle_connection), i want to tell `spammer` method to stop looping
<FromGitter> <bew> No, you should use either a signal variable or maybe a channel to control the spammer's loop
<FromGitter> <Dillybob1992> signal variables? what is this sorcery. ok will read on those now
<FromGitter> <bew> Nothing magic, just a variable like `need_stop = false`, and you make your loop as: `until need_stop; code; end`
<FromGitter> <bew> And you'll just need to set `need_stop = true` somewhere to stop the loop
woodruffw has quit [Read error: Connection timed out]
<FromGitter> <Dillybob1992> oh gotit
<Papierkorb> just make the looped method return true/false if it wants to be called again or not. No need to add vars
woodruffw has joined #crystal-lang
cremes has quit [Quit: cremes]
moei has quit [Quit: Leaving...]
woodruffw has quit [Ping timeout: 255 seconds]
cremes has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
<FromGitter> <Dillybob1992> Kemal Websocket benchmark is kinda of crazy
<FromGitter> <Dillybob1992> i am so happy i am switching to crystal
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <sdogruyol> welcome and glad to hear that :) @Dillybob1992
<FromGitter> <Dillybob1992> haha, you are the author, great article btw :) 👍
jnyw has joined #crystal-lang
<FromGitter> <Dillybob1992> I have a question about memory management not sure if I am doing this right. In my code below, I delete the `RPG_USER` class from my `users` array when a user disconnects. since everything is "objects" in crystal, this means if I keep a clean `users` array, the memory will be cleaned up on `delete`?
<ogotai> is there a smarter way to assign literals, e.g. this "stat : UInt32 = 0" fails because 0 is assumed to be Int32, so has to be converted to "stat : UInt32 = 0_u32" - do all literals have to be strictly type specific?
<faustinoaq> ogotai, for now yes, see: https://github.com/crystal-lang/crystal/issues/2995
<ogotai> faustinoaq: thanks, glad to see community wants this implemented (somehow), hope it comes soon
cremes has quit [Quit: cremes]
qard has joined #crystal-lang
<FromGitter> <l3kn> @Dillybob1992 How do you mean that? Deleting the user from the array is enough, the GC should take care of the rest
woodruffw has joined #crystal-lang
OceannBoy has joined #crystal-lang
<FromGitter> <Dillybob1992> @l3kn oh really, so there is no memory management i have to do?
<FromGitter> <Dillybob1992> wow, im liking crystal even more!!
<FromGitter> <l3kn> @Dillybob1992 Have you used other programming languages before? Maybe one of them is comparable in that regard
sz0 has joined #crystal-lang
<FromGitter> <Dillybob1992> javascript (nodejs) lol
<FromGitter> <Dillybob1992> i mean, i always know i need to keep arrays clean i guess,that's an instilled value that will carry me good in crystal, right
<FromGitter> <l3kn> javascript is garbage collected, too, so you don't need to do anything else in crystal
<FromGitter> <Dillybob1992> @l3kn sweet!
faustinoaq has quit [Quit: IRC client terminated!]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
OceannBoy has quit [Ping timeout: 256 seconds]
OceannBoy has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]