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
cremes has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
<oprypin> RX14, there is a 0.24.2 milestone on GitHub that I've seen others apply. maybe not everything goes to Next
<RX14> 0.24.2 is bugfixes for 0.24.1
<RX14> Next is 0.25.x
<RX14> everything's Next until it's put in the release/0.24 branch
<oprypin> seems like that fix for elliptic curves or whatever should be in 0.24.2
<RX14> perhaps
marius has joined #crystal-lang
cremes has quit [Quit: cremes]
relyks has quit [Quit: relyks]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marius has quit [Quit: marius]
Ven`` has joined #crystal-lang
illyohs has quit [Read error: Connection reset by peer]
relyks has joined #crystal-lang
<FromGitter> <elorest> `some_command` used to return stdout and stderr. This seems to have changed with 0.24.1. How would I accomplish this now?
<FromGitter> <bew> Are you sure it returned stderr too?
<FromGitter> <elorest> Either it returned stderr or crystal eval used to return stdout for errors.
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <elorest> ```result = `crystal eval 'Unknown1.call'` ⏎ pp result``` ⏎ ⏎ In 0.23.1 and before that returned the error. In 0.24.1 the result is empty. [https://gitter.im/crystal-lang/crystal?at=5a499baeb48e8c3566876a59]
<FromGitter> <elorest> https://carc.in/#/r/3bi8
<FromGitter> <bew> Maybe eval changed?
<FromGitter> <elorest> Maybe. I didn't see that in the change log. Either way how would I get the response now?
<FromGitter> <elorest> Any ideas?
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<jnyw> Hi, i'm working on a cli app. I thought all the files would go in src/ but after going through the crystal-lang book it seems I should be putting files in lib/. Can anyone explain to me the difference between lib/src for the source files?
<jnyw> also i'm trying to add tests for some of my functions but it keeps exiting with 0 tests run when i run 'crystal spec'. It looks like it's because it's supposed to exit when no args are passed to it BUT i tried to pass a valid option to it '--output' and it just gives me OptionParser::InvalidOption. How should I be testing individual classes/the app as a whole?
<jnyw> any help would be appreciated thanks
Ven`` has joined #crystal-lang
Ven`` has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
relyks has joined #crystal-lang
<FromGitter> <elorest> <jnyw> lib is where all of your deps go.
<FromGitter> <elorest> everything else should go in src/project_name/
<crystal-gh> [crystal] matiasgarciaisaia pushed 1 new commit to master: https://git.io/vbx8L
<crystal-gh> crystal/master 4c8e71a Matías García Isaía: Update LICENSE's copyright year...
<jnyw> whoops. thanks for clearing that up elorest. I think I figured it out now, the spec_helper.cr was running my app because it was requiring the src/<project name>.cr file instead of spec/<project name>/* like I intended. got it working now. :)
DTZUZU has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
marius has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <elorest> Happy New Years.
marius has quit [Quit: marius]
relyks has quit [Quit: relyks]
prince has joined #crystal-lang
prince has left #crystal-lang [#crystal-lang]
prince has joined #crystal-lang
vegai has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
prince has quit [Quit: Leaving]
<FromGitter> <bararchy> @elorest 🎉
<FromGitter> <bararchy> Is there anyway I can marshal a class? via msgpack only native types are allowed
<oprypin> bararchy, maybe Papierkorb/cannon is relevant. or maybe msgpack shard has something like jsonmapping
<oprypin> or custom written code never hurt anyone
<FromGitter> <elorest> @bararchy MessagePack only supports a few types by design... but you should be able to map them in ok though.
<FromGitter> <bararchy> it does, but the type you map can only be made of native types, so I can have MyType as long as it's basiclly combination of basic types
<FromGitter> <elorest> MessagePack is the only decent binary serialization shard we have currently
<FromGitter> <elorest> Yeah for sure. would be nice if we had grpc or something.
<FromGitter> <elorest> messagePack over tcp works pretty good though.
<FromGitter> <bararchy> Oh, cannon can actually handle classes
<FromGitter> <bararchy> this is really cool
claudiuinberlin has joined #crystal-lang
<FromGitter> <straight-shoota> @elorest, jnyw You don't need to put files in `src/project_name`. `src` is just fine, there won't be any namespace collisions like in Ruby.
<oprypin> it's a very bad habit, also encouraged by `crystal init`'s templae
<oprypin> i hate the way projects lay out their files so much omg
<FromGitter> <straight-shoota> oprypin #5428 removes that
<DeBot> https://github.com/crystal-lang/crystal/pull/5428 (Use shards version in crystal init tool)
<oprypin> that's not without problems
<FromGitter> <straight-shoota> ho so?
<oprypin> hard depepndency on shards
<oprypin> and also it being in PATH
<oprypin> defeats the whole point of shards being separate. which i don't support in the first place, but consistency is more important
<FromGitter> <straight-shoota> what is in PATH?
<oprypin> nothing, ideally
<oprypin> but this assumes that `shards` is in PATH mukkina, which cards you have does not matter, only the number of them
<oprypin> uuuuuuh that's a horrible mis-paste
<FromGitter> <straight-shoota> ah yes
<FromGitter> <straight-shoota> I'm not particularly fond of hard dependency on shards either, but for this purpose it seems legit.
<FromGitter> <straight-shoota> `crystal init` is perhaps the first real compiler command run by novice developers following a Crystal tutorial. So it should have all batteries included and can assume that `shards` is available because thats what you should begin with.
<FromGitter> <straight-shoota> It is very opinionated but dedicated towards developer happiness.
<FromGitter> <straight-shoota> And it's good for the ecosystem that people use shards
<crystal-gh> [crystal] chastell opened pull request #5498: Fix String#gsub and #tr ASCII-only optimisations (master...ASCII_replacements) https://git.io/vbxgu
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 248 seconds]
<crystal-gh> [crystal] chastell opened pull request #5499: Fix String#to_i spec typo (master...String#to_i_spec_typo) https://git.io/vbxav
<RX14> I don't really mind a hard dependency on shards myself
<RX14> there should be one way to do things
<RX14> and shards should be it
<FromGitter> <bararchy> ^ agree, it seems that package managers already added shards as a dependency.
<lvmbdv> any plans to merge it into the crystal executable?
<RX14> no
<RX14> and there shouldn't be
<lvmbdv> would save a couple of lines from package builds ¯\_(ツ)_/¯
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] chastell opened pull request #5500: Add (and use) String#unsafe_chr_at (master...String#unsafe_chr_at) https://git.io/vbxaD
greengriminal has joined #crystal-lang
jnyw has quit [Quit: WeeChat 2.0.1]
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a4a31c5ba39a53f1ac33a38]
<FromGitter> <bararchy> hm....
<FromGitter> <bararchy> woot?
<oprypin> what
alex`` has quit [Quit: WeeChat 2.0.1]
<oprypin> n[:synapses_in] is a terrible mess of types
<oprypin> your rampant use of symbols really worries me btw
<FromGitter> <bararchy> no, its ⏎ ⏎ ```n[:synapses_in] = Array(Hash(Symbol, String | Float64)).new``` [https://gitter.im/crystal-lang/crystal?at=5a4a3289b48e8c3566899133]
<oprypin> symbols should not be part of a public API but you use them to specify function type for some reason, instead of actually passing a function
<oprypin> had to say it
<FromGitter> <bararchy> I use them as id's for Hash fields, just like it better then Strings
<oprypin> i think that `compile-time type is (Array(Hash(Symbol, Float64 | String)) | Float64 | String | Symbol)` is quite clear
<FromGitter> <bararchy> It is, why the compiler thinks that it my issue
<oprypin> one of the values in `n` can be float64
<oprypin> hence `n[:synapses_in]` can be float64
<FromGitter> <bararchy> ohhhh
<FromGitter> <bararchy> I see
<FromGitter> <bararchy> damn, my bad. ⏎ Though shouldn't .as((Hash(Symbol, String | Float64))) should have taken care of it?
<oprypin> that is irrelevant, you're doign that in the right side but the problem is in the left side
<FromGitter> <bararchy> ahhhh
<FromGitter> <bararchy> it thinks the Array, might be the Float
<FromGitter> <bararchy> I see
<oprypin> bararchy, https://github.com/NeuraLegion/shainet#usage i think there should be no symbols there, especially the `:sigmoid` thing
<FromGitter> <bararchy> isn't it better to use Symbol instead of Strings?
<FromGitter> <bararchy> coming from Ruby i know it's encourged
<FromGitter> <bararchy> for uniqness and performance
<oprypin> strings is so extremely bad that it doesn't need to be mentioned
<FromGitter> <bararchy> so... enums?
<oprypin> in some cases yes
<oprypin> in the case of activation function, how about actually passing a function?
<oprypin> meanwhile, the spam bots are warning up, in #travis atm
<FromGitter> <bararchy> the activation functions are pretty static, in the sense you will likely choose one of the existing ones and not just roll you'r own, which means that it makes sense to choose from X options
<FromGitter> <bararchy> or you actually mean pass `SHAInet.sigmod` for example?
<oprypin> something like that
<FromGitter> <bararchy> hm...
<oprypin> you're not losing anything by this, but instead gaining compile time error handling and infinite flexibility
<FromGitter> <bararchy> let me play around with it
<oprypin> these symbols totally destroy compile time error handling, but it's not even the worst part
cremes has joined #crystal-lang
<FromGitter> <bararchy> what is the worst part then? :)
<oprypin> API vagueness and lack of flexibility
<FromGitter> <bararchy> btw, any idea on how should I pass in a function so that I can do something like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a4a38c803838b2f2a5a8f61]
<oprypin> the URL looks the same lol
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a4a3a4803838b2f2a5a9706]
<FromGitter> <bararchy> cool :)
<FromGitter> <bararchy> thanks oprypin
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vbxrw
<crystal-gh> crystal/master 24fedf2 Piotr Szotkowski: Fix String#to_i spec typo
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vbxr5
<crystal-gh> crystal/master 15a357c TSUYUSATO Kitsune: Fix formatting call arguments with trailing comments...
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vbxrd
<crystal-gh> crystal/master dadbeb6 TSUYUSATO Kitsune: Fix String#sub with negative index...
<RX14> oh so ary's back... and on the core team?
<RX14> i'm half of the opinion he'd probably have more fun if he wasn't
<Papierkorb> He did write a lengthy new years resolution on the ML
<RX14> i saw it
<Papierkorb> You even replied to it
<RX14> well not a new year's resolution
<RX14> but I took from that that he'd be coming back as a contributor
<RX14> guess I assumed wrong
<Papierkorb> Oh, my dict says I assumed 'new years res' to mean something slightly different.
<RX14> maybe I misread it
<RX14> aand the replies to the mailing list have gotten into opinion again
<RX14> never would have guessed
<FromGitter> <bararchy> lol
<Papierkorb> The ML hasn't been that historically significant for proposing changes, so no harm done
<RX14> @asterite please milestone PRs after merging!
<RX14> hopefully ary gets an email about that in about... 3 hours
<RX14> thanks gitter
<Papierkorb> It's a shame btw, there have been two attempts (At least one successful) at porting Qt5.cr to Mac OS already. One in here and another guy reached me via email. Haven't heard back from either.
<Papierkorb> Would be kinda ironic if windows gets a native port before mac
<dom96> Nice of Ary to mention Nim :)
<FromGitter> <asterite> RX14 I'm back as a core team member because some PRs are easy to merge and most of the time it's just your approval, so I could help speed up things a bit. But I won't feel pressure to fix bugs and improve things anymore, only if I find the task non-boring or straight forward. Others can fix bugs and improve things too.
<RX14> @asterite thanks!
<RX14> hopefully more manas people will have more time to do run of the mill PR reviews soon
<FromGitter> <asterite> It would be nice, yes
<RX14> they've told me they'll be able to make a much larger commitment in january
<RX14> we'll see how that goes
<travis-ci> crystal-lang/crystal#dadbeb6 (master - Fix String#sub with negative index): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/323775917
cremes has quit [Quit: cremes]
<FromGitter> <imonmyown> great news 👏
cremes has joined #crystal-lang
<crystal-gh> [crystal] chastell opened pull request #5501: Refactor String#char_bytesize_at (master...refactor_String#char_bytesize_at) https://git.io/vbxK5
<crystal-gh> [crystal] chastell opened pull request #5502: Fix invalid UTF-8 byte sequence spec typo (master...invalid_string_spec_typo) https://git.io/vbx6O
cremes has quit [Quit: cremes]
alex`` has joined #crystal-lang
<crystal-gh> [crystal] chastell closed pull request #5498: Fix String#gsub and #tr ASCII-only optimisations (master...ASCII_replacements) https://git.io/vbxgu
<crystal-gh> [crystal] jhass pushed 1 new commit to master: https://git.io/vbxiP
<crystal-gh> crystal/master 00880be Piotr Szotkowski: Fix invalid UTF-8 byte sequence spec typo
<FromGitter> <sdogruyol> welcome back Ary, it's always great to see you here @asterite ✨
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
cremes has joined #crystal-lang
sz0 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#00880be (master - Fix invalid UTF-8 byte sequence spec typo): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/323796417
Ven`` has joined #crystal-lang
hightower3 has quit [Remote host closed the connection]
cremes has quit [Quit: cremes]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
<dragonkh> hi - does Crystal have any form of for comprehension - similar to Scala?
<RX14> what do you mean?
<RX14> what specifically are you trying to do dragonkh
DTZUZU has quit [Ping timeout: 256 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dragonkh> RX14 - I mean something like this: https://gist.github.com/kingsleyh/f94f42bd032e1d188f723fba85d1d0ec
<dragonkh> I want to find an idiomatic crystal way of avoiding those nested if statements in the first version
<dragonkh> in scala I would do something more like the second version
<RX14> Early return?
<RX14> return false unless foo
<dragonkh> I'm finding my code is ending up with lots of nested if, case etc
<dragonkh> hmm I'll give that a try
cremes has joined #crystal-lang
<dragonkh> cool thanks - looks more appealing on the eye
<RX14> although its a bit weird
<RX14> why CurrentUser | Bool
<RX14> instead of CurrentUser | Nil
<RX14> then just
<RX14> `return unless`
<RX14> leave out the `nil`
<RX14> i mean
<RX14> `false`
<RX14> well hopefully you get the idea
<dragonkh> ah yeah - that works too
<dragonkh> still getting into Crystal :)
alex`` has quit [Quit: WeeChat 2.0.1]
hightower2 has joined #crystal-lang
cremes has quit [Quit: cremes]
DTZUZU has joined #crystal-lang
alex`` has joined #crystal-lang
<crystal-gh> [crystal] chastell closed pull request #5500: Spec String#unsafe_byte_at (master...String#unsafe_chr_at) https://git.io/vbxaD
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
hightower2 has quit [Changing host]
hightower2 has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.0.1]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vbxQO
<crystal-gh> crystal/master d7273c7 Johannes Müller: Fix: String#gsub replacing ascii chars to work in non-ascii string (#5350)...
rohitpaulk has quit [Ping timeout: 268 seconds]
illyohs has joined #crystal-lang
<travis-ci> crystal-lang/crystal#d7273c7 (master - Fix: String#gsub replacing ascii chars to work in non-ascii string (#5350)): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/323847300
<DeBot> https://github.com/crystal-lang/crystal/pull/5350 (Fix: String#gsub replacing ascii chars to work in non-ascii string)
vivus has joined #crystal-lang
faustinoaq has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] chastell opened pull request #5503: Protect internal String methods (master...protect_internal_String_methods) https://git.io/vbxFt
greengriminal has quit [Quit: Leaving]
<woodruffw> what's the right way to unpack binary data in crystal? right now i'm using a `Slice(UInt8)` and interpreting it via `.to_unsafe.as(Pointer(Int32)).value`, but this feels a little clunky/messy
<jsn-> IO::ByteFormat?
<woodruffw> ah, i didn't know that existed. perfect, thanks!
<RX14> woodruffw, where is this data coming from?
<RX14> because 99% of the time the binary data that needs to be unpacked is coming from external to the application
<RX14> which means an IO stream
<RX14> which means it's much easier just to use IO#read_bytes
<RX14> and IO#write_bytes
<RX14> as very nice shortcuts for the ByteFormat stuff
<woodruffw> RX14: yep, it's coming from an IO stream. i'm dealing with a type-and-length prefixed JSON format coming over a unix socket
<woodruffw> `IO#read_bytes` and `IO#write_bytes` looks even better, thanks a lot
<RX14> np
<RX14> actually dealing with Slices when unpacking data is quite rare
<RX14> Slices, at least Bytes are mainly used just to say "here's a block of binary data that is in memory but I don't care what's in it"
<woodruffw> that makes sense; crystal's preference for directly dealing with `IO` just takes a bit of getting used to coming from ruby :p
<RX14> it's far faster to use IO at least
<RX14> less data copies
sz0 has quit [Quit: Connection closed for inactivity]
hightower2 has quit [Remote host closed the connection]
DTZUZU has quit [Read error: Connection reset by peer]
cremes has joined #crystal-lang
dahhowl has quit [Ping timeout: 264 seconds]
dahhowl has joined #crystal-lang
<dragonkh> hi
<dragonkh> I upgraded to crystal 24 and now I have a problem: undefined constant SecureRandom
<dragonkh> did something change with SecureRandom?
<oprypin> yes. now it's Random::Secure
<dragonkh> aah: Random::Secure.uuid has been replaced with UUID.random
<dragonkh> bah UUID.random not found
<dragonkh> Random::Secure.uuid not found either
<dragonkh> i cant figure out what SecureRandom.uuid should be replaced with in v 24?
<dragonkh> anyone can point me in the right direction?
<jsn-> require "uuid"
<dragonkh> UUID.uuid does not exist
<RX14> it's UUID.random
<RX14> it works
<RX14> you just need to require "uuid"
<RX14> whereas you used require "secure_random" before
<dragonkh> ok that bit works but some shards I was using are broken
<RX14> might need to update them
<dragonkh> I think I will have to downgrade
<RX14> are you sure that they're not updated already
<RX14> which shards?
<dragonkh> rethinkdb
<RX14> you can always fix them yourself
<dragonkh> kemal-session
<dragonkh> kemal-session-redis
<RX14> kemal-session can be updated by @sdogruyol
<RX14> the other two are probably fairly easy to upgrade
<dragonkh> ok - I've taken master
<dragonkh> for kemal-session
<RX14> yeah
<RX14> @sdogruyol just needs to release a release
<dragonkh> I need to fix rethinkdb
<RX14> the other two, what are the errors?
<dragonkh> in lib/rethinkdb/src/rethinkdb/serialization.cr:38: undefined method 'to_reql' for UUID
<RX14> yeah
<RX14> and add define
<RX14> add to struct UUID
<RX14> a new def to_reql
<RX14> which is just
<RX14> to_s.to_reql
<RX14> and try that
<RX14> do it just below String's to_reql define
<dragonkh> and on line 96?
<dragonkh> I have to handle something there too?
<dragonkh> so I need to add a new struct into serialization.cr called UUID and add a def to_reql - self.as JSON::Type ?
<RX14> not quite
<RX14> def to_reql
<RX14> to_s.to_reql
<RX14> end
<RX14> in struct UUID
<RX14> in that file
<dragonkh> ok there is no struct UUID yet - I will add it
<RX14> yes
<RX14> it already exists
<dragonkh> it already exists?
<RX14> you're just reopening the exisint struct UUID
<RX14> it's defined in the stdlib
<dragonkh> ah ok
<RX14> thats why htere's UUID.random
<RX14> you're just adding a enw method
<dragonkh> and do I need to add UUID into the list on line 4 and line 96?
<dragonkh> maybe not
<RX14> on line 4 yes
<RX14> on line 96 no
<dragonkh> ok
<dragonkh> I should require "uuid" in the file
<dragonkh> looks like to_json cant handle UUID either
<dragonkh> :(
<RX14> darn
<RX14> ok well
<RX14> dragonkh, just open an issue for now
<dragonkh> I'll have to either UUID.random.to_s or make a to_json
<RX14> and i think UUID.random.to_s is fine
<dragonkh> I'll downgrade to 23 for now
<dragonkh> there are so many errors
<RX14> :(
jnyw has joined #crystal-lang
<dragonkh> I cant fix them all right now
<RX14> well open an issue regardless
<dragonkh> ok - with rethinkdb
<dragonkh> looks like ots not maintained anymore
<dragonkh> oh yay - its working now
<dragonkh> I upgraded kemal and all the errors went away
<dragonkh> so just will use my rethinkdb version for now and will raise an issue
jnyw has quit [Quit: WeeChat 2.0.1]
illy_ has joined #crystal-lang
illyohs has quit [Read error: Connection reset by peer]
cremes has quit [Quit: cremes]