ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
hgost has left #crystal-lang ["WeeChat 2.1"]
pn-max has joined #crystal-lang
<pn-max> oprypin, the reason I used codes instead of keys is because I missed the parse method in the crystal enums /facepalm
<FromGitter> <girng> wow, so i recently update to the latest april update on windows. crystal compiles now way faster,
<FromGitter> <girng> such a night n day difference, im loving it
<FromGitter> <girng> in the WSL issue, someone suggested that i update and i did but the problem is still happening: can see it in action here (https://streamable.com/9mch8). i wonder what's going on
<FromGitter> <Blacksmoke16> crystal on windows?
<FromGitter> <Blacksmoke16> thats a thing now?
<FromGitter> <girng> lol yes
<FromGitter> <Blacksmoke16> nice
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> (using WSL)
gizmore has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
gizmore|2 has quit [Ping timeout: 256 seconds]
<FromGitter> <Blacksmoke16> ah
greengriminal has joined #crystal-lang
<FromGitter> <girng> i cry
<FromGitter> <girng> this not good :(
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <masukomi> got what feels like a stupid question. Writing something that reads piped data. Hangs waiting for input if nothing piped to it. How do i test if there's anything in ARGF so i don't hang?
greengriminal has quit [Quit: This computer has gone to sleep]
<pn-max> girng have you tried using the values to display something to check if you get the hiccups this way
<FromGitter> <girng> @pn-max values from where? srry not sure what u mean
<pn-max> the side that gets the hiccups when they're displayed in the terminal
<pn-max> to make sure its not just the terminal display fucking up
<FromGitter> <girng> oh, yeah it's not the terminal at all. cause i can puts the message in a regular loop outside oft he tcp server and terminal still smooth as butter
<FromGitter> <girng> that's what i thought at first too
<FromGitter> <girng> i mean, i tested it on a debian 9 crappy VSP, and the hiccups arn't even there through a remote SSH connection
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> Instead of visual constatation of hiccup in the display (where a lot of things could impact speed), can you time the message receive, and see if there are some 'pic' or anything (times where it takes more time), also check the message sending, maybe it's just a little delayed
rohitpaulk has quit [Ping timeout: 240 seconds]
<pn-max> ^
<FromGitter> <girng> @bew like this? https://paste.ee/p/mRjHn
<FromGitter> <girng> i measure the time difference
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
<FromGitter> <girng> This guy says it doesn't even happen to him......
dannyAAM has joined #crystal-lang
pn-max has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
Philpax_ has joined #crystal-lang
<FromGitter> <girng> strace: https://paste.ee/p/MgPzb
alex`` has quit [Quit: WeeChat 2.1]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
alex has joined #crystal-lang
rohitpaulk has joined #crystal-lang
ua has quit [Ping timeout: 276 seconds]
ua has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
alex has quit [Ping timeout: 255 seconds]
alex has joined #crystal-lang
alex has quit [Read error: Connection reset by peer]
alex has joined #crystal-lang
alex has quit [Ping timeout: 255 seconds]
zorp has joined #crystal-lang
greengriminal has joined #crystal-lang
zorp has quit [Ping timeout: 260 seconds]
ua has quit [Ping timeout: 255 seconds]
ua has joined #crystal-lang
<FromGitter> <vladfaust> Hello. Does anybody knows a way to get a bytesize of a generic Object?
<FromGitter> <bararchy> sounds like something that can't really work
<FromGitter> <bararchy> Object can be anything
<FromGitter> <bararchy> what is your usecase ?
<FromGitter> <vladfaust> I'm implementing Tarantool driver. It's protocol is described here: https://tarantool.io/en/doc/1.9/dev_guide/internals_index.html#unified-packet-structure. The thing I'm struggle with is: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af83725b84be71db9027298]
<FromGitter> <vladfaust> I'm okay with packing header & body with https://github.com/crystal-community/msgpack-crystal, but I don't know how to set up size properly
<FromGitter> <vladfaust> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af837a052194a4a67df9567]
Philpax_ has quit [Ping timeout: 256 seconds]
<FromGitter> <bararchy> every object is a logical container for data, what does your containr contains? ⏎ ⏎ ```struct Foo ⏎ @bar : Int32 ⏎ end``` ⏎ ⏎ we know that `Foo.size == sizeof(Int32)` ... [https://gitter.im/crystal-lang/crystal?at=5af838382df44c2d0623cce6]
<oprypin> i think generally you'll be interested in instance_sizeof
<FromGitter> <vladfaust> @bararchy AdminCommandCodes is a enum
<oprypin> but now that i take a 2nd look at this, you most likely should not mess with sizes directly
<FromGitter> <vladfaust> I didn't know about `sizeof`. So, `struct` doesn't have any size itself, right?
<oprypin> sure it does
<oprypin> jeez i'
<oprypin> why am i not finishing the damn article
<FromGitter> <vladfaust> > *<oprypin>* sure it does
<FromGitter> <vladfaust> > we know that Foo.size == sizeof(Int32)
<FromGitter> <vladfaust> ?
<oprypin> what no
<oprypin> there isnt even such a thing as .size in general
<FromGitter> <vladfaust> So what should I place as size in my case? It's a Tuple of two ints; 8 then?
<oprypin> you shouldnt place any size, the msgpack protocol should know the size
<oprypin> man how i wish all shards had generated api docs
<oprypin> too bad the author of crystal basically died (i hope they didnt actually die)
<oprypin> *docrystal* sorry
<FromGitter> <vladfaust> I read msgpack src & specs. You sure it places size in the beginning automatically?
<FromGitter> <vladfaust> Unpacking isn't an issue for me yet, I'm struggle with sending requests
<oprypin> you should either use `send` and `receive` OR use socket only as an IO for both packing and unpacking directly
<oprypin> i had no idea these two were a thing. it's send the size and the message, and the other one is receive the size and a message of that size
<oprypin> BUT, msgpack can also figure things out without a size. one thing is 100% sur, you must not use `gets` on the socket
<FromGitter> <bararchy> oprypin https://play.crystal-lang.org/#/r/42gq
<FromGitter> <bararchy> AFAIK struct does not have a size
<FromGitter> <bararchy> the size is of all the members inside
<oprypin> you're saying it does not have a size then say what the size is
<oprypin> now i understand what you mean: it does not have overhead in addition to size of members
<FromGitter> <bararchy> Yeha ^ that's what I meant
<FromGitter> <hmans> What is up, Crystalland
<FromGitter> <hmans> (back from a mini vacation)
zorp has joined #crystal-lang
<oprypin> well you've probably seen the recent pull requests from asterite
<oprypin> expecting a release soon
<oprypin> not much else
<FromGitter> <hmans> That's cool.
<FromGitter> <hmans> Oh, the new annotations have landed. I see.
<txdv> the new annotations?
<txdv> link?
<oprypin> and https://github.com/crystal-lang/crystal/pull/6074 is the other big one
<FromGitter> <bararchy> 1) 1 is gonna be damn huge
<FromGitter> <hmans> Is there an ETA for the release? (No rush, just wondering if there is one, or if it's "whenever".)
<oprypin> there was but i cant find it
<oprypin> basically as soon as some guy at Manas gets time to do it :|
<txdv> and the macro system can get ahold of them
<oprypin> saying "some guy" only because i cant find reference aabout the exact name, but there was an exact name
<txdv> reminds me of an onion skit where the report at the location outtroduces himself with "Just some fucking guy"
<txdv> reporter*
<FromGitter> <hmans> Looking forward.
<FromGitter> <bararchy> oprypin I think it's @mgarciaisaia job to close a version
<FromGitter> <bararchy> if I remmber correctly
<FromGitter> <bararchy> though I think it makes more sense that when 3 core-devs agree then just push a new release
<FromGitter> <faustinoaq> Hey `File.file?` and `File.exists?` and `Dir.exists?`is not redundant?
<FromGitter> <j8r> @faustinoaq not really
<FromGitter> <j8r> `Dir.exists?` return true only the path is a dir, `File.exists` returns true if the pathe exists (file or dir)
<oprypin> inconsistent then
<oprypin> should be Path#file? Path#dir? anyway
<FromGitter> <j8r> totally oprypin I was thinking exactly that
<FromGitter> <faustinoaq> Yeah, `Path.file?` and `Path.dir?` seems less misleading
<oprypin> #
<FromGitter> <j8r> `Path#file?`, `Path#dir?` and for both included `Path#exists?`
<FromGitter> <faustinoaq> Yep, Maybe we can create `File.filepath` to avoid create a new `Path` class, WDYT? 😅
<FromGitter> <j8r> I'm doinf some cleanups for on this topic https://github.com/crystal-lang/crystal/pull/6092
<FromGitter> <j8r> We can keep `Dir.exists` and change `File.exists` to only a file that exists, not a path
<oprypin> it makes sense but is not worth it
<oprypin> why break it twice when you can just make `Path` and forget about all this
<FromGitter> <j8r> If we really don't want to create `Path` : `File.exists?("/") || Dir.exists?("/")`
<FromGitter> <j8r> the more urgent cleanup was changing the ugly `Dir.rmdir` and `Dir.mkdir` :-o
<oprypin> my opinion is that `File` and `Dir` class methods are a catastrophe and cannot be fixed incrementally
<FromGitter> <j8r> but `Path` hasn't landed yet :-/
<oprypin> so wait for it to land
zorp_ has joined #crystal-lang
zorp has quit [Ping timeout: 248 seconds]
zorp_ has quit [Read error: Connection reset by peer]
<FromGitter> <bararchy> oprypin ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Is this bad? [https://gitter.im/crystal-lang/crystal?at=5af84c139ad18967b9e06e89]
<oprypin> bararchy, it's inconsequential for you. just says some doc comments are outdated
<FromGitter> <bararchy> k
<FromGitter> <bararchy> having a problem generating the crsfml bindings on Ubuntu machine, on Arch it was painless, but on Ubuntu which I needed to manually install 2.5.0 It shows linking errors
<FromGitter> <bararchy> can't find symbols etc.
<oprypin> bararchy, did you have version 2.4 on that machine before?
<FromGitter> <bararchy> yeha, but I removed it
<FromGitter> <bararchy> and cleaned most of what it didn't auto-remove
<oprypin> you need to clean up voidcsfml .so files
<FromGitter> <bararchy> I did, purged both `lib/` and `.shards`
<FromGitter> <bararchy> maybe I missed libsfml artifacts somewhere
<oprypin> well that sucks
<oprypin> are you perhaps missing some of my updates
<oprypin> don't use your fork :p
<oprypin> hmm seems fine
<FromGitter> <bararchy> I do lol, but I updated my fork
<FromGitter> <bararchy> :)
<FromGitter> <bararchy> my fork is gold
<FromGitter> <j8r> you can `find / -name "*sfml*"` :-D
<FromGitter> <bararchy> I'll give you a few more days to apprechiate the buty
<FromGitter> <bararchy> beuty
<FromGitter> <bararchy> damn..
<FromGitter> <bararchy> how the hell do I write this word
<FromGitter> <bararchy> lol
<oprypin> so i was getting the linking errors myself and i wasn't sure how i got rid of them
<oprypin> can you paste the error
<FromGitter> <j8r> haha, you just know how to write ugly?
<oprypin> and also what you have in voidcsfml folder
<FromGitter> <bararchy> `!=ugly`
<FromGitter> <bararchy> this is the error
<oprypin> it is actually incorrect
<oprypin> you may have merged incorrectly
<oprypin> "correct link order" commit is not in action
<FromGitter> <bararchy> oprypin damn, but it works on Arch
<FromGitter> <bararchy> ok, fixed
<FromGitter> <bararchy> I just moved to your branch
<FromGitter> <bararchy> while adding my "hack" to the `test.sh` launcher file
<oprypin> the problem with your suggestion is that the resulting executable contains the absolute path to that directory, so it's not portable at all
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af8523d52194a4a67dfd3de]
<FromGitter> <bararchy> Where nothing makes sense anymore
<FromGitter> <bararchy> lol
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af852795e8e2175e260b9f7]
<FromGitter> <bararchy> why `libsfml-graphics.so.2.5 => not found` ?
<FromGitter> <bararchy> ok, figured it out, my bad
<FromGitter> <bararchy> All those `export`s messed the global load path
pierrearseufrasi has joined #crystal-lang
pierrearseufrasi has quit [Quit: Leaving]
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <hmans> What's the canonical way (if there is one) of adding command line argument support to a Crystal CLI app?
<FromGitter> <hmans> I'm guessing the `OptionParser` module?
<oprypin> hmans, the canonical way is by using `ARGV` in whatever way you please. one of those ways (you mentioned) happens to be in the standard library
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <hmans> :)
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37_ is now known as p0p0pr37
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <j8r> Some don't like OptionParser - you have better to use one of https://github.com/veelenga/awesome-crystal#cli-builders
<FromGitter> <j8r> or https://github.com/j8r/clicr :D
<FromGitter> <hmans> Thanks @j8r.
alex`` has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
andrewzah has left #crystal-lang ["WeeChat 2.1"]
greengriminal has joined #crystal-lang
commavir has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
jeromegn has quit []
jeromegn has joined #crystal-lang
jeromegn has left #crystal-lang [#crystal-lang]
jeromegn has joined #crystal-lang
<Majost> I have been trying to use docopt myself since I am fond of the concept.... but the crystal version is in need of some love since its not well documented.
<Majost> I am actually trying to debug some stuff with it now: https://github.com/rhass/timberclaw/blob/master/src/timberclaw/cli.cr
<Majost> heh
<Majost> I am trying to use a setter, and am getting compile time error of: `no overload matches 'Timberclaw::Config#file=' with type (Array(String) | Bool | Int32 | String | Nil)`
<Majost> I suspect it may be a docopt issue that is causing this for me
<Majost> Because this is the line its complaining about: https://github.com/rhass/timberclaw/blob/master/src/timberclaw/cli.cr#L55
<Majost> but when I do pretty print on `@opts["--config"].class` I get `String`, and not an Array(String)
<Majost> So I am not really sure why that is happening
<Majost> Actually, travis has the error too: https://travis-ci.org/rhass/timberclaw
<Majost> And changing my setter to `setter file : String | Array(String)`results in: `in /usr/local/Cellar/crystal-lang/0.24.2_1/src/file.cr:172: undefined method 'check_no_null_byte' for Array(String) (compile-time type is (Array(String) | String))`
<Majost> Which I am not sure if it is a crystal bug or something else
<oprypin> Majost, can you start from the beginning?
<oprypin> or just show your code
<oprypin> oh, this is committed code?
<Majost> yeah
<oprypin> `def initialize(opts : Array(String))` - you realize that opts is not used?
<oprypin> `@opts : Hash(String, Array(String) | Bool | Int32 | String | Nil)`
<oprypin> `@opts["--config"] : Array(String) | Bool | Int32 | String | Nil`
<oprypin> `config.file : String`
<oprypin> `config.file = opts["--config"]`
<oprypin> see any problem here?
<oprypin> that's very nice that you set it but it's never used in the method
<oprypin> that's beside the point though
alex`` has quit [Quit: WeeChat 2.1]
<Majost> Where are you seeing this line: `config.file : String`?
<oprypin> Majost, this is not actual code. i'm just saying what the type of each value is
<Majost> Ah
<oprypin> and that there is a mismatch
<oprypin> tldr file = @opts["--config"].as(String)
<Majost> Right, so docopt is a little wierd -- but opts is a Hash
<Majost> and "--config" is the key
<Majost> So I am trying to to a hash lookup and get back the string value
<oprypin> ok
<oprypin> the compiler knows that the Hash's value can be any of Array(String) | Bool | Int32 | String | Nil
<Majost> Oh, so I need to allow that getter to be any of those types?
<Majost> er setter rather
<oprypin> I repeat `file = @opts["--config"].as(String)`
<oprypin> you make a type assertion
<Majost> So it should be: `setter file : Array(String) | Bool | Int32 | String | Nil`
<oprypin> you are 100% sure that it will be a string. docopt guarantees that, the compiler just has no way to perceive that "verbal" guarantee
<Majost> ah
<Majost> cool
<Majost> Thanks
<Majost> =)
<oprypin> it would be such a "fun" project to implement docopt which actually conveys this guarantee to the compiler
<oprypin> it's doable because macros are turing-complete
<oprypin> but it's still implementing docopt in macros xD
<oprypin> hm actually with `macro run` it would not be so bad
<Majost> hehe
<oprypin> i should look into it
<Majost> I like the whole docopt concept a lot... it forces you to create your code around the experience you want people to have
<oprypin> its reputation has only been going downhill in recent years
<oprypin> but hey, i still own one language port of docopt :p
<Majost> there are some things I wish were a little different like the key names not prefix with `--` and whatnot.
<Majost> hah
<oprypin> well the dashes are posix standard so...
<Majost> oh I get that... I think this is implementation specific (Ruby version as well) that maintains the hyphens in the key names rather than stripping them off... eg: `@opts["--config"]` instead of @opts["config"].
<Majost> Just a nitpick though.
<oprypin> ah, that
<oprypin> i think it's nice
<Majost> I gotta head out, thanks again!
<FromGitter> <girng> happy mother's day
<FromGitter> <girng> ROFL. if i run `strace -ff crystal socket.cr 2> socket.strace` the hiccups don't happen
<FromGitter> <girng> i wonder what that means, what could `strace` be doing to crystal / or WSL?
Philpax has joined #crystal-lang